Skip to main content

SingleLocalPackReader

Struct SingleLocalPackReader 

Source
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

Source

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.

Source

pub fn open_allow_loose(objects_dir: &Path) -> Result<Option<Self>>

Open when one local pack exists, optionally ignoring loose objects (commit parent walks).

Source

pub fn read_commit_author_prefix( &mut self, oid: &ObjectId, ) -> Result<Option<&[u8]>>

Inflate the start of commit oid into an internal buffer (undeltified entries only).

Returns None when the object is missing, not a commit, or stored as a delta.

§Errors

Propagates pack index and zlib errors.

Source

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.

Source

pub fn read_object(&mut self, oid: &ObjectId) -> Result<Object>

Decompress the object for oid.

§Errors

Same as read_object_from_pack_at_offset.

Source

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.

Source

pub fn pack_offset(&self, oid: &ObjectId) -> Result<Option<u64>>

Pack file offset for oid in this reader’s index, if present.

§Errors

Propagates pack index lookup errors.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.