Re: [PATCH v3 1/6] odb: introduce interface to generate packfiles

Patrick Steinhardt <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <[email protected]>
On Thu, Aug 20, 2026 at 03:16:37AM -0700, Karthik Nayak wrote:
> Patrick Steinhardt <[email protected]> writes:
> > diff --git a/odb/source.h b/odb/source.h
> > index d69f8e2d1c..e2129766fc 100644
> > --- a/odb/source.h
> > +++ b/odb/source.h
> > @@ -278,6 +278,23 @@ struct odb_source {
> >  	 */
> >  	bool (*optimize_required)(struct odb_source *source,
> >  				  const struct odb_optimize_options *opts);
> > +
> > +	/*
> > +	 * This callback is expected to start generating a packfile with the
> > +	 * given options. The pack shall be generated asynchronously so that
> > +	 * the caller can consume the pack data and progress output while the
> > +	 * pack is being generated.
> > +	 *
> > +	 * This callback is optional. Sources that cannot generate packfiles
> > +	 * shall leave it unset.
> > +	 *
> > +	 * The callback is expected to return 0 on success and populate the
> > +	 * `out` pointer with the pack generator, a negative error code
> > +	 * otherwise.
> > +	 */
> > +	int (*generate_pack)(struct odb_source *source,
> > +			     struct odb_pack_generator **out,
> > +			     const struct odb_generate_pack_options *opts);
> >  };
> >
> 
> Nit: I see that `source` is unused anyways, do we need to pass it in? Or
> is just for consistency?

Our specific implementation does not use it, but others might want. So
it's mostly for consistency to give the callback enough context.

Patrick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.