[PATCH 00/16] packfile: carve out a new packfile store
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Aug 19, 2025, 08:19 UTC
- Message-ID
- <20250819-b4-pks-packfiles-store-v1-0-1660842e125a@pks.im>
Hi,
information about a object database's packfiles is currently distributed across two different structures:
- `struct packed_git` contains the `next` pointer as well as the
`mru_head`, both of which serve to store the list of packfiles. - `struct object_database` contains several fields that relate to the
packfiles.So we don't really have a central data structure that tracks our packfiles, and consequently responsibilities aren't always clear cut. A consequence for the upcoming pluggable object databases is that this makes it very hard to move management of packfiles from the object database level down into the object database source.
This patch series introduces a new `struct packfile_store`, which is about to become the single source of truth for managing packfiles, and carves out the packfile store subsystem.
This is the first step to make packfiles work with pluggable object databases. Next steps will be to:
- Move the `struct packed_git::next` and `struct packed::mru_head`
pointers into the packfile store so that `struct packed_git` only
tracks a single packfile. - Push the `struct packfile_store` down one level so that it's not
hosted by the object database anymore, but instead by the object
database source.Thanks!
Patrick
---
Patrick Steinhardt (16):
packfile: introduce a new `struct packfile_store`
odb: move list of packfiles into `struct packfile_store`
odb: move initialization bit into `struct packfile_store`
odb: move packfile map into `struct packfile_store`
odb: move MRU list of packfiles into `struct packfile_store`
odb: move kept cache into `struct packfile_store`
packfile: reorder functions to avoid function declaration
packfile: refactor `prepare_packed_git()` to work on packfile store
packfile: split up responsibilities of `reprepare_packed_git()`
packfile: refactor `install_packed_git()` to work on packfile store
packfile: always add packfiles to MRU when adding a pack
packfile: introduce function to load and add packfiles
packfile: move `get_multi_pack_index()` into "midx.c"
packfile: remove `get_packed_git()`
packfile: refactor `get_all_packs()` to work on packfile store
packfile: refactor `get_packed_git_mru()` to work on packfile storebuiltin/backfill.c | 2 +- builtin/cat-file.c | 2 +- builtin/count-objects.c | 2 +- builtin/fast-import.c | 8 +- builtin/fsck.c | 8 +- builtin/gc.c | 12 +- builtin/grep.c | 2 +- builtin/index-pack.c | 10 +- builtin/pack-objects.c | 22 ++-- builtin/pack-redundant.c | 4 +- builtin/receive-pack.c | 2 +- builtin/repack.c | 8 +- bulk-checkin.c | 2 +- connected.c | 4 +- fetch-pack.c | 4 +- http-backend.c | 4 +- http.c | 4 +- http.h | 2 +- midx.c | 26 ++-- midx.h | 2 + object-name.c | 6 +- odb.c | 37 ++++-- odb.h | 34 ++--- pack-bitmap.c | 4 +- pack-objects.c | 2 +- packfile.c | 293 ++++++++++++++++++++++++-------------------- packfile.h | 111 ++++++++++++++--- server-info.c | 2 +- t/helper/test-find-pack.c | 2 +- t/helper/test-pack-mtimes.c | 2 +- transport-helper.c | 2 +- 31 files changed, 354 insertions(+), 271 deletions(-)
--- base-commit: c44beea485f0f2feaf460e2ac87fdd5608d63cf0 change-id: 20250806-b4-pks-packfiles-store-a44a608ca396