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

From: Patrick Steinhardt <[email-masked]>
Date: Tue, 20 Aug 2024 14:00:49 +0200

On Mon, Aug 19, 2024 at 11:55:16AM -0500, Justin Tobler wrote:
> On 24/08/13 08:24AM, Patrick Steinhardt wrote:
> > 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 <[email-masked]>
> > ---
> [snip]
> > diff --git a/reftable/reftable-merged.h b/reftable/reftable-merged.h
> > index 14d5fc9f05..4deb0ad22e 100644
> > --- a/reftable/reftable-merged.h
> > +++ b/reftable/reftable-merged.h
> > @@ -36,6 +36,14 @@ int reftable_new_merged_table(struct reftable_merged_table **dest,
> >  			      struct reftable_table *stack, size_t n,
> >  			      uint32_t hash_id);
> >  
> > +/* Initialize a merged table iterator for reading refs. */
> > +void reftable_merged_table_init_ref_iterator(struct reftable_merged_table *mt,
> > +					     struct reftable_iterator *it);
> > +
> > +/* Initialize a merged table iterator for reading logs. */
> > +void reftable_merged_table_init_log_iterator(struct reftable_merged_table *mt,
> > +					     struct reftable_iterator *it);
> 
> I might have missed it, but I do not see 
> `reftable_merged_table_init_log_iterator()` used anywhere in the later
> patches. Does this need to be added? Or are we just adding it because we
> want a companion function to the ref iterator to be more consistent? 

The latter. It really should exist to make the public interface
complete.

Patrick