pub struct IndexedPack {
pub num_objects: u32,
pub pack_id: ObjectId,
pub index_id: ObjectId,
pub pack_version: PackVersion,
pub hash_kind: Kind,
pub index_path: Option<PathBuf>,
pub data_path: Option<PathBuf>,
pub stored_bytes: Option<u64>,
pub keep_path: Option<PathBuf>,
}Expand description
What came out of taking a pushed pack into storage.
A receipt, not a handle: every field is a fact read back off what was
stored, and nothing here reaches into the store to answer. The three
Option<PathBuf>s are None on every engine that does not keep git’s
on-disk layout — which is the default one — and None there is the truth
rather than a degraded answer.
Fields§
§num_objects: u32How many objects the resulting pack holds.
For a thin pack this is larger than the number of entries that arrived on the wire: bases pulled in from the store to complete it are counted too.
pack_id: ObjectIdThe pack’s trailing checksum, which is its identity and the <id> in
pack-<id>.pack.
index_id: ObjectIdThe checksum of the written index file, or a null id where no index file exists.
pack_version: PackVersionThe pack format version that was read.
hash_kind: KindThe hash kind of the pack and index.
index_path: Option<PathBuf>Where the .idx landed, if one was written.
data_path: Option<PathBuf>Where the .pack landed, if one was written.
stored_bytes: Option<u64>How many bytes the stored pack occupies, when the store knows and there
is no file to stat.
§Why this is not the same question as data_path
A packfile engine answers “how big is the pack that landed” by measuring
the file it wrote. An engine that writes no packfile — the znippy store
appends the received bytes VERBATIM into its archive — has no file, and
for a while that made the whole measurement an unknown: every push
into the engine gunnar ships logged
pack_bytes_unknown="pack … was indexed without a directory".
That was false. The store counts the bytes it appends
(PushReceipt::pack_bytes); nobody carried the number this far. An
absence rendered where a measurement exists is the same defect as a
measurement rendered where an absence exists, and it is worse
here, because a reader is told gunnar does not know something it does.
None means “ask data_path” — the pack IS a file and its size is that
file’s size, which is the truer answer for an engine that has one. It
still means genuinely unknown when there is no file either, and callers
must keep reporting that as unknown rather than as zero: rendering the
missing file as new_object_bytes: 0 reads as a push that stored
nothing, in the one record a verifier is supposed to be able to trust.
keep_path: Option<PathBuf>The .keep file guarding the new pack from collection until refs point
at it. The caller owns it and is expected to remove it once the ref
transaction is applied.