Re: [PATCH 07/17] odb/source: make `reprepare()` function pluggable
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 5, 2026, 13:23 UTC
- Message-ID
- <aamD1y5Dw1Oypg1n@pks.im>
- In-Reply-To
- <aaiei2ZN37i0Xkf8@denethor>
On Wed, Mar 04, 2026 at 03:08:16PM -0600, Justin Tobler wrote:
Show 26 quoted lines
> On 26/02/23 05:17PM, Patrick Steinhardt wrote:
> > Introduce a new callback function in `struct odb_source` to make the
> > function pluggable.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> [snip]
> > diff --git a/odb/source.h b/odb/source.h
> > index f84da59ef0..2f8132f9e1 100644
> > --- a/odb/source.h
> > +++ b/odb/source.h
> > @@ -58,6 +58,13 @@ struct odb_source {
> > * all associated resources. The function will never be called with a NULL pointer.
> > */
> > void (*free)(struct odb_source *source);
> > +
> > + /*
> > + * This callback is expected to clear underlying caches of the object
> > + * database source. The function is called when the repository has for
> > + * example just been repacked so that new objects will become visible.
> > + */
> > + void (*reprepare)(struct odb_source *source);
>
> Naive question: does repreparing a source still make sense outside of
> the "files" ODB source? I almost sounds like it should be an internal
> detail of the source when reading objects.Ideally it would be, and I agree that repreparing is a detail that we should in the best case never have to handle. In fact, I have plans to eventually refactor this to a `prepare()` function as we have some sites that want to ensure that the backends have been loaded before doing any operation.
In that case, we'd likely add a `force` flag or something like that to cover the repreparing use case. But ideally I agree with you that such uses should be reduced over time.
Patrick