Skip to main content

Module pack

Module pack 

Source
Expand description

Pack files, indexes, and packfile I/O.

Structs§

LocalPackInfo
Basic information about local packs.
PackData
Immutable bytes of a .pack, pack index, commit-graph, MIDX, or packed-refs file.
PackIndex
Parsed pack index with fanout-accelerated OID lookup and in-place table reads.
PackIndexEntry
Owned pack index row (collect from PackIndex::iter when needed).
PackIndexEntryRef
Borrowed view of one row in a pack index.
PackLookupOptions
Options controlling which local packs participate in a lookup pass.
ReuseWriteStats
Counters updated while streaming reused pack bytes.
SingleLocalPackReader
Sorted cat-file --batch reader for repos with exactly one local pack (hot-path benchmarks).
StreamingReuse
Active verbatim reuse context while streaming a pack body.
VerifyObjectRecord
A decoded object header record used by verify-pack.

Enums§

PackedDeltaDependency
Dependency of a packed delta object at object_offset within pack_bytes.
PackedType
A pack object type as encoded in the packed stream header.

Constants§

DEFAULT_PACK_DEPTH
Default in-pack delta chain depth when pack.depth is unset (matches Git).

Functions§

apply_delta_depth_limit
Break only delta chains longer than max_depth edges in a target→base map.
clear_pack_cache
Drop pack/MIDX caches on every registered PackStore.
clear_pack_delta_base_cache
Drop only the process-wide delta-base LRU (indexes and pack bytes stay cached).
collect_local_pack_info
Collect aggregate local pack metrics.
collect_packed_delta_reuse_for_send
collect_packed_delta_reuse_for_send function.
compute_fanout_from_entries
Compute the 256-entry fanout from owned entries (legacy helper for tests).
compute_fanout_from_oid_slices
Compute fanout from a sorted OID list (used when writing v1 indexes in tests).
configure_delta_base_cache_from_config
Apply core.deltaBaseCacheLimit from repository config to the process-wide delta-base LRU.
hash_object_bytes
Hash canonical loose object bytes (kind SP size NUL data) with the repo hash width.
max_verify_pack_delta_depth
Longest delta-chain depth among verify-pack records (number of edges from base to tip).
oid_bytes_to_hex
oid_bytes_to_hex function.
pack_index_entry_matches_sha1_oid
True when entry stores a SHA-1 OID matching oid (SHA-256 pack entries are ignored).
pack_index_is_v1
Whether idx_path uses the legacy v1 pack-index format (no PACK signature).
packed_delta_base_oid
packed_delta_base_oid function.
packed_full_object_slice
When oid is stored as a full (non-delta) object in a local pack, return its verbatim packed bytes: the varint type+size header followed by the zlib stream.
packed_ref_delta_reuse_slice
If oid is stored as REF_DELTA or OFS_DELTA in a local pack and its base OID is in packed_set, return the base OID and the uncompressed delta payload (Git binary delta).
parse_pack_index_bytes
Parse pack index bytes (v1 or v2). When verify is true, check the trailing checksum.
read_alternates_recursive
Read alternates recursively, deduplicated in discovery order.
read_idx_object_ids
Read all object IDs from a .idx file.
read_local_pack_indexes
Read all valid .idx files in objects/pack.
read_local_pack_indexes_cached
Read all pack indexes under <objects_dir>/pack/ from the process-wide cache.
read_object_from_pack
Read an object from a pack file by its OID.
read_object_from_pack_at_offset
Read a packed object when the pack index entry is already known (batch cat-file workloads).
read_object_from_pack_bytes
Resolve an object from already-loaded pack bytes (used by verify-pack).
read_object_from_pack_into
Like read_object_from_pack, inflating into buf and reusing its capacity.
read_object_from_packs
Search all pack indexes in objects_dir for the given OID and read it.
read_object_from_packs_into
Like read_object_from_packs, inflating into buf and reusing its capacity.
read_object_info_from_pack
Read ObjectInfo for oid stored in idx’s pack without inflating the full object body.
read_object_info_from_pack_at_offset
Read ObjectInfo at a known pack offset (avoids a second index lookup in batch workloads).
read_object_info_from_packs
Search local packs for oid and return its kind and uncompressed size.
read_pack_bytes_cached
Read pack file bytes from the process-wide cache.
read_pack_index
Parse a pack index file (version 1 legacy or version 2), verifying the SHA-1 trailer checksum.
read_pack_index_cached
Read a single pack index from the process-wide cache (parses from disk on miss). Skips trailer verification.
read_pack_index_no_verify
Parse a pack index file without verifying the SHA-1 trailer checksum.
read_packed_delta_dependency
If the object at object_offset is a delta, return how it refers to its base.
refresh_pack_bytes_signature
Re-stamp the cached pack-bytes signature after deliberately touching pack_path’s mtime (object freshening). See the internal pack_cache::refresh_pack_signature helper.
reprepare_pack_directory_on_miss
Re-scan the pack directory when its mtime changed since the cached listing.
revalidate_stale_pack_bytes
Re-read pack_path when its on-disk signature differs from the cached entry.
skip_one_pack_object
skip_one_pack_object function.
slice_one_pack_object
Advance pos past one packed object (including zlib payload).
test_pack_cache_guard
Serializes tests that mutate the process-global pack cache (integration tests).
try_read_object_from_local_packs_cached
Resolve oid from local packs via the process-wide pack cache (cached .idx parses, cached pack bytes, fanout binary search, delta-base cache).
try_write_streaming_pack
Write a PACK stream to w using bitmap reachability and verbatim reuse when possible.
verify_pack_and_collect
Verify one pack/index pair and optionally return object records.
write_v2_pack_index
write_v2_pack_index function.
write_v2_pack_index_with_trailer
Write a version-2 .idx for entries describing objects in pack_path.