From: karthik nayak <karthik.188@gmail.com>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH 1/8] refs/reftable: encapsulate reftable stack
Date: Tue, 5 Nov 2024 05:03:00 -0600 [thread overview]
Message-ID: <CAOLa=ZR89CRuJ7nwBfbGhi-wFuwEc96qNoid8sNKHD5ssmrOXg@mail.gmail.com> (raw)
In-Reply-To: <b599bcdac191fd3cfb7797accebd79211e757c47.1730732881.git.ps@pks.im>
[-- Attachment #1: Type: text/plain, Size: 2702 bytes --]
Patrick Steinhardt <ps@pks.im> writes:
> The reftable ref store needs to keep track of multiple stacks, one for
> the main worktree and an arbitrary number of stacks for worktrees. This
> is done by storing pointers to `struct reftable_stack`, which we then
> access directly.
>
> Wrap the stack in a new `struct reftable_backend`. This will allow us to
> attach more data to each respective stack in subsequent commits.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> refs/reftable-backend.c | 129 +++++++++++++++++++++++-----------------
> 1 file changed, 73 insertions(+), 56 deletions(-)
>
> diff --git a/refs/reftable-backend.c b/refs/reftable-backend.c
> index 38eb14d591..43cba53cb1 100644
> --- a/refs/reftable-backend.c
> +++ b/refs/reftable-backend.c
> @@ -32,6 +32,23 @@
> */
> #define REF_UPDATE_VIA_HEAD (1 << 8)
>
> +struct reftable_backend {
> + struct reftable_stack *stack;
> +};
> +
> +static int reftable_backend_init(struct reftable_backend *be,
> + const char *path,
> + const struct reftable_write_options *opts)
> +{
> + return reftable_new_stack(&be->stack, path, opts);
> +}
> +
> +static void reftable_backend_release(struct reftable_backend *be)
> +{
> + reftable_stack_destroy(be->stack);
> + be->stack = NULL;
> +}
> +
> struct reftable_ref_store {
> struct ref_store base;
>
> @@ -39,17 +56,17 @@ struct reftable_ref_store {
> * The main stack refers to the common dir and thus contains common
> * refs as well as refs of the main repository.
> */
Shouldn't these comments be updated to say s/stack/backend, while the
backend contains the stack, it is confusing to read stack and see
backend.
> - struct reftable_stack *main_stack;
> + struct reftable_backend main_backend;
> /*
> * The worktree stack refers to the gitdir in case the refdb is opened
> * via a worktree. It thus contains the per-worktree refs.
> */
Here too.
> - struct reftable_stack *worktree_stack;
> + struct reftable_backend worktree_backend;
> /*
> * Map of worktree stacks by their respective worktree names. The map
> * is populated lazily when we try to resolve `worktrees/$worktree` refs.
> */
Here too.
> - struct strmap worktree_stacks;
> + struct strmap worktree_backends;
> struct reftable_write_options write_options;
>
> unsigned int store_flags;
[snip]
> @@ -772,14 +789,14 @@ static struct ref_iterator *reftable_be_iterator_begin(struct ref_store *ref_sto
> * right now. If we aren't, then we return the common reftable
> * iterator, only.
> */
> - if (!refs->worktree_stack)
> + if (!refs->worktree_backend.stack)
Nit: Not your fault, but this is misaligned no?
> return &main_iter->base;
>
[snip]
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]
next prev parent reply other threads:[~2024-11-05 11:03 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 15:11 [PATCH 0/8] refs/reftable: reuse iterators when reading refs Patrick Steinhardt
2024-11-04 15:11 ` [PATCH 1/8] refs/reftable: encapsulate reftable stack Patrick Steinhardt
2024-11-05 11:03 ` karthik nayak [this message]
2024-11-04 15:11 ` [PATCH 2/8] refs/reftable: handle reloading stacks in the reftable backend Patrick Steinhardt
2024-11-05 11:14 ` karthik nayak
2024-11-06 10:43 ` Patrick Steinhardt
2024-11-04 15:11 ` [PATCH 3/8] refs/reftable: read references via `struct reftable_backend` Patrick Steinhardt
2024-11-05 11:20 ` karthik nayak
2024-11-04 15:11 ` [PATCH 4/8] refs/reftable: refactor reading symbolic refs to use reftable backend Patrick Steinhardt
2024-11-04 15:11 ` [PATCH 5/8] refs/reftable: refactor reflog expiry " Patrick Steinhardt
2024-11-04 15:11 ` [PATCH 6/8] reftable/stack: add mechanism to notify callers on reload Patrick Steinhardt
2024-11-04 15:11 ` [PATCH 7/8] reftable/merged: drain priority queue on reseek Patrick Steinhardt
2024-11-05 3:16 ` Junio C Hamano
2024-11-05 3:23 ` Junio C Hamano
2024-11-05 7:14 ` Patrick Steinhardt
2024-11-04 15:11 ` [PATCH 8/8] refs/reftable: reuse iterators when reading refs Patrick Steinhardt
2024-11-05 4:49 ` [PATCH 0/8] " Junio C Hamano
2024-11-05 9:11 ` [PATCH v2 " Patrick Steinhardt
2024-11-05 9:11 ` [PATCH v2 1/8] refs/reftable: encapsulate reftable stack Patrick Steinhardt
2024-11-12 6:07 ` Junio C Hamano
2024-11-05 9:12 ` [PATCH v2 2/8] refs/reftable: handle reloading stacks in the reftable backend Patrick Steinhardt
2024-11-12 6:41 ` Junio C Hamano
2024-11-12 9:05 ` Patrick Steinhardt
2024-11-05 9:12 ` [PATCH v2 3/8] refs/reftable: read references via `struct reftable_backend` Patrick Steinhardt
2024-11-12 7:26 ` Junio C Hamano
2024-11-12 9:05 ` Patrick Steinhardt
2024-11-05 9:12 ` [PATCH v2 4/8] refs/reftable: refactor reading symbolic refs to use reftable backend Patrick Steinhardt
2024-11-05 9:12 ` [PATCH v2 5/8] refs/reftable: refactor reflog expiry " Patrick Steinhardt
2024-11-05 9:12 ` [PATCH v2 6/8] reftable/stack: add mechanism to notify callers on reload Patrick Steinhardt
2024-11-05 9:12 ` [PATCH v2 7/8] reftable/merged: drain priority queue on reseek Patrick Steinhardt
2024-11-05 9:12 ` [PATCH v2 8/8] refs/reftable: reuse iterators when reading refs Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 0/9] " Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 1/9] refs/reftable: encapsulate reftable stack Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 2/9] refs/reftable: handle reloading stacks in the reftable backend Patrick Steinhardt
2024-11-26 0:31 ` Junio C Hamano
2024-11-25 7:38 ` [PATCH v3 3/9] reftable/stack: add accessor for the hash ID Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 4/9] refs/reftable: read references via `struct reftable_backend` Patrick Steinhardt
2024-11-26 0:48 ` Junio C Hamano
2024-11-26 6:41 ` Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 5/9] refs/reftable: refactor reading symbolic refs to use reftable backend Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 6/9] refs/reftable: refactor reflog expiry " Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 7/9] reftable/stack: add mechanism to notify callers on reload Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 8/9] reftable/merged: drain priority queue on reseek Patrick Steinhardt
2024-11-25 7:38 ` [PATCH v3 9/9] refs/reftable: reuse iterators when reading refs Patrick Steinhardt
2024-11-25 9:47 ` [PATCH v3 0/9] " Christian Couder
2024-11-25 9:52 ` Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 00/10] " Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 01/10] refs/reftable: encapsulate reftable stack Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 02/10] refs/reftable: handle reloading stacks in the reftable backend Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 03/10] reftable/stack: add accessor for the hash ID Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 04/10] refs/reftable: figure out hash via `reftable_stack` Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 05/10] refs/reftable: read references via `struct reftable_backend` Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 06/10] refs/reftable: refactor reading symbolic refs to use reftable backend Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 07/10] refs/reftable: refactor reflog expiry " Patrick Steinhardt
2024-11-26 6:42 ` [PATCH v4 08/10] reftable/stack: add mechanism to notify callers on reload Patrick Steinhardt
2024-11-26 6:43 ` [PATCH v4 09/10] reftable/merged: drain priority queue on reseek Patrick Steinhardt
2024-11-26 6:43 ` [PATCH v4 10/10] refs/reftable: reuse iterators when reading refs Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOLa=ZR89CRuJ7nwBfbGhi-wFuwEc96qNoid8sNKHD5ssmrOXg@mail.gmail.com' \
--to=karthik.188@gmail.com \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).