midx: start tracking per object database source
Multi-pack indices are tracked via `struct multi_pack_index`. This data
structure is stored as a linked list inside `struct object_database`,
which is the global database that spans across all of the object
sources.
This layout causes two problems:
- Object databases consist of multiple object sources (e.g. one source
per alternate object directory), where each multi-pack index is
specific to one of those sources. Regardless of that though, the
MIDX is not tracked per source, but tracked globally for the whole
object database. This creates a mismatch between the on-disk layout
and how things are organized in the object database subsystems and
makes some parts, like figuring out whether a source has an MIDX,
quite awkward.
- Multi-pack indices are an implementation detail of how efficient
access for packfiles work. As such, they are neither relevant in the
context of loose objects, nor in a potential future where we have
pluggable backends.
Refactor `prepare_multi_pack_index_one()` so that it works on a specific
source, which allows us to easily store a pointer to the multi-pack
index inside of it. For now, this pointer exists next to the existing
linked list we have in the object database. Users will be adjusted in
subsequent patches to instead use the per-source pointers.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
c29998d1d4
commit
4d8be89d97
9
odb.h
9
odb.h
@@ -13,6 +13,7 @@ struct oidmap;
|
||||
struct oidtree;
|
||||
struct strbuf;
|
||||
struct repository;
|
||||
struct multi_pack_index;
|
||||
|
||||
/*
|
||||
* Compute the exact path an alternate is at and returns it. In case of
|
||||
@@ -55,6 +56,13 @@ struct odb_source {
|
||||
/* Map between object IDs for loose objects. */
|
||||
struct loose_object_map *loose_map;
|
||||
|
||||
/*
|
||||
* private data
|
||||
*
|
||||
* should only be accessed directly by packfile.c and midx.c
|
||||
*/
|
||||
struct multi_pack_index *midx;
|
||||
|
||||
/*
|
||||
* This is a temporary object store created by the tmp_objdir
|
||||
* facility. Disable ref updates since the objects in the store
|
||||
@@ -75,7 +83,6 @@ struct odb_source {
|
||||
};
|
||||
|
||||
struct packed_git;
|
||||
struct multi_pack_index;
|
||||
struct cached_object_entry;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user