On Tue, May 06, 2025 at 09:21:15PM -0400, Derrick Stolee wrote: > On 5/6/25 7:09 AM, Patrick Steinhardt wrote: > > There are a couple of iterator-style functions that execute a callback > > for each instance of a given set, all of which currently depend on > > `the_repository`. Refactor them to instead take an object database as > > parameter so that we can get rid of this dependency. > ... > > +/* > > + * Iterate through all backends of the database and execute the provided > > + * callback function for each of them. Stop iterating once the callback > > + * function returns a non-zero value, in which case the value is bubbled up > > + * from the callback. > > + */ > > +typedef int odb_for_each_backend_fn(struct odb_backend *, void *); > > +int odb_for_each_backend(struct object_database *odb, > > + odb_for_each_backend_fn cb, void *payload); > > + > > +/* > > + * Iterate through all alternative object backends of the database and yield > > + * their respective references. > > + */ > > +typedef void odb_for_each_alternate_ref_fn(const struct object_id *oid, void *); > > +void odb_for_each_alternate_ref(struct object_database *odb, > > + odb_for_each_alternate_ref_fn cb, void *payload); > > + > > Here's another occasion where we should be careful about how we rename > an "alternate odb". What is an "alternate ref" if we have different 'odb > backend's (or slices/shards/odbs etc.). Should we be updating the term > "alternate ref" here? > > Changing 'alternate ref' would be quite difficult seeing how it is based > on the 'core.alternateRefsCommand' and 'core.alternateRefsPrefix' config > keys. > > Perhaps this is motivation to keep the word 'alternate' but as a way to > differentiate the repo's odb from ones it is borrowing. Yeah, the next iteration will call things `odb_alternate` instead of `odb_backend`, which I think makes a lot of the terminology fall out naturally. The only thing that may be confusing at first is that we also have a "primary alternate" now, but I think that's bearable. > I'm sorry to nitpick so much here, but your thorough series is helping > to bring to mind all of the different aspects that are being conflated > by our current nomenclature that grew organically and is now being > carefully designed for the better. I very much invite this nitpicking on this series, so please don't be sorry. Patrick