Re: [RFC/WIP PATCH] object store classification
- Date: Mon, 10 Jul 2017 18:17:52 -0700
- From: Stefan Beller <sbeller@xxxxxxxxxx>
- Subject: Re: [RFC/WIP PATCH] object store classification
On Fri, Jul 7, 2017 at 9:50 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Ben Peart <peartben@xxxxxxxxx> writes:
>> For more API/state design purity, I wonder if there should be an
>> object_store structure that is passed to each of the object store APIs
>> instead of passing the repository object. The repository object could
>> then contain an instance of the object_store structure.
>> That said, I haven't take a close look at all the code in object.c to
>> see if all the data needed can be cleanly abstracted into an
>> object_store structure.
> My gut feeling was it is just the large hashtable that keeps track of
> objects we have seen, but the object replacement/grafts and other
> things may also want to become per-repository.
This is similar to the_index which is referenced by the_repository.
But as we do not have anything like the_object_store already, we are
free to design it, as the required work that needs to be put in is the
With the object replacements/grafts coming up as well as alternates,
we definitely want that to be per repository, the question is if we rather
the_repository -> many object_stores (one for each, alternate, grafts,
and the usual place at $GIT_DIR/objects
where the object_store is a hashmap, maybe an additional describing
string or path.
the_repository -> the_object_store
but the object store is a complex beast having different hash tables
for the different alternates.
the_repository -> the_object_store_hash_map
which is this patch that would try to put any object related to this
repository into the same hashmap and the hashmap is not special
for each of the different object locations.
>> One concern I have is that the global state refactoring effort will
>> just result in all the global state getting moved into a single
>> (global) repository object thus limiting it's usefulness.
> I actually am not worried about it that much, and I say this with
> the background of having done the same "grouping a set of global
> state variables into a single structure and turning them into a
> single default instance" for the_index. Whether you like it or not,
> the majority of operations do work on the default instance---that
> was why the operations could live with just "a set of global state
> variables" in the first place, and the convenience compatibility
> macros that allow you to operate on the fields of the default
> instance as if they were separate variables have been a huge
> typesaver that also reduces the cognitive burden. I'd expect that
> the same will hold for the new "repository" and the "object_store"
Sounds reasonable to expect.