pub struct SingleLocalPackReader { /* private fields */ }Expand description
Sorted cat-file --batch reader for repos with exactly one local pack (hot-path benchmarks).
Keeps a pack index cursor so probes in non-decreasing OID order avoid repeated binary search.
Implementations§
Source§impl SingleLocalPackReader
impl SingleLocalPackReader
Sourcepub fn open(objects_dir: &Path) -> Result<Option<Self>>
pub fn open(objects_dir: &Path) -> Result<Option<Self>>
Open when crate::pack_store::PackStore read context matches and one local pack index exists.
§Errors
Propagates pack directory read failures from index loading.
Sourcepub fn open_allow_loose(objects_dir: &Path) -> Result<Option<Self>>
pub fn open_allow_loose(objects_dir: &Path) -> Result<Option<Self>>
Open when one local pack exists, optionally ignoring loose objects (commit parent walks).
Inflate the start of commit oid into an internal buffer.
Resolves deltified pack entries via the delta-base cache and prefix delta apply.
Returns None when the object is missing, not a commit, or cannot be resolved.
§Errors
Propagates pack index and zlib errors.
Sourcepub fn read_info(&mut self, oid: &ObjectId) -> Result<ObjectInfo>
pub fn read_info(&mut self, oid: &ObjectId) -> Result<ObjectInfo>
Kind and size for oid without loading the object body.
§Errors
Same as read_object_info_from_pack_at_offset.
Sourcepub fn read_object(&mut self, oid: &ObjectId) -> Result<Object>
pub fn read_object(&mut self, oid: &ObjectId) -> Result<Object>
Sourcepub fn read_object_into(
&mut self,
oid: &ObjectId,
out: &mut Vec<u8>,
) -> Result<ObjectKind>
pub fn read_object_into( &mut self, oid: &ObjectId, out: &mut Vec<u8>, ) -> Result<ObjectKind>
Like Self::read_object, inflating into out and preserving its capacity when possible.
Delta bases resolved along the way are not added to the delta-base cache.