git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 01/10] reftable/merged: expose functions to initialize iterators

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 14, 2024, 12:56 UTC
Message-ID
<ZryphS1KICCYWi9z@tanuki>
In-Reply-To
<CAOLa=ZSY8EWuXAK_tF4sSYGHs2Mv6nE-YtVtVkau4k5h=hOEdA@mail.gmail.com>
On Tue, Aug 13, 2024 at 05:36:27AM -0400, karthik nayak wrote:
Show 41 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > We do not expose any functions via our public headers that would allow a
> > caller to initialize a reftable iterator from a merged table. Instead,
> > they are expected to go via the generic `reftable_table` interface,
> > which is somewhat roundabout.
> >
> > Implement two new functions to initialize iterators for ref and log
> > records to plug this gap.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> >  reftable/merged.c          | 12 ++++++++++++
> >  reftable/reftable-merged.h |  8 ++++++++
> >  2 files changed, 20 insertions(+)
> >
> > diff --git a/reftable/merged.c b/reftable/merged.c
> > index 6adce44f4b..8d78b3da71 100644
> > --- a/reftable/merged.c
> > +++ b/reftable/merged.c
> > @@ -254,6 +254,18 @@ void merged_table_init_iter(struct reftable_merged_table *mt,
> >  	iterator_from_merged_iter(it, mi);
> >  }
> >
> > +void reftable_merged_table_init_ref_iterator(struct reftable_merged_table *mt,
> > +					     struct reftable_iterator *it)
> > +{
> > +	merged_table_init_iter(mt, it, BLOCK_TYPE_REF);
> > +}
> > +
> > +void reftable_merged_table_init_log_iterator(struct reftable_merged_table *mt,
> > +					     struct reftable_iterator *it)
> > +{
> > +	merged_table_init_iter(mt, it, BLOCK_TYPE_LOG);
> > +}
> > +
> 
> These too look similar to `static void
> reftable_merged_table_init_iter_void` defined a little below, I wonder
> if we could have simply exposed that? Perhaps we remove it in the
> upcoming patches.

Yup, `reftable_merged_table_init_iter_void()` is about to go away. But regardless of that, even if it didn't it would make sense to have both functions. The `iter_void()` one takes an arbitrary block type as input, which we never expose via our public interfaces. So it has to stay an implementation detail. The new ones added here do not expose the block type.

Patrick
Previous: karthik nayakNext: Justin Tobler
Message 4 of 25 in “reftable: drop generic `reftable_table` interface”
  1. 00/10 reftable: drop generic `reftable_table` interfacePatrick Steinhardt, Aug 13, 2024
  2. 01/10 reftable/merged: expose functions to initialize iteratorsPatrick Steinhardt, Aug 13, 2024
  3. karthik nayakAug 13, 2024
  4. Patrick SteinhardtAug 14, 2024
  5. Justin ToblerAug 19, 2024
  6. Patrick SteinhardtAug 20, 2024
  7. 02/10 reftable/merged: rename `reftable_new_merged_table()`Patrick Steinhardt, Aug 13, 2024
  8. 03/10 reftable/merged: stop using generic tables in the merged tablePatrick Steinhardt, Aug 13, 2024
  9. karthik nayakAug 13, 2024
  10. Justin ToblerAug 19, 2024
  11. 04/10 reftable/stack: open-code reading refsPatrick Steinhardt, Aug 13, 2024
  12. 05/10 reftable/iter: drop double-checking logicPatrick Steinhardt, Aug 13, 2024
  13. Eric SunshineAug 13, 2024
  14. 06/10 reftable/generic: move generic iterator code into iterator interfacePatrick Steinhardt, Aug 13, 2024
  15. karthik nayakAug 13, 2024
  16. Patrick SteinhardtAug 14, 2024
  17. Junio C HamanoAug 14, 2024
  18. karthik nayakAug 15, 2024
  19. 07/10 reftable/dump: drop unused `compact_stack()`Patrick Steinhardt, Aug 13, 2024
  20. 08/10 reftable/dump: drop unused printing functionalityPatrick Steinhardt, Aug 13, 2024
  21. karthik nayakAug 13, 2024
  22. Patrick SteinhardtAug 14, 2024
  23. 09/10 reftable/dump: move code into "t/helper/test-reftable.c"Patrick Steinhardt, Aug 13, 2024
  24. 10/10 reftable/generic: drop interfacePatrick Steinhardt, Aug 13, 2024
  25. karthik nayakAug 13, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.