Skip to main content

BoundedPackDecoder

Struct BoundedPackDecoder 

Source
pub struct BoundedPackDecoder<S> { /* private fields */ }
Expand description

A targeted decoder tied to one or more registered pack sources.

Delta chains are planned in a heap vector and resolved from base to target, so call-stack use is constant with respect to attacker-controlled depth. The internal cache and materialization budget are shared across every registered source. Each source’s length and contents, including open std::fs::File values, must remain stable for the decoder’s lifetime. Cache accounting is by logical body bytes, not entry count, and Self::clear_cache releases every decoder-held object. Cross-pack REF chains must be registered as locations before the read; the decoder follows them iteratively without a resolver callback or nested decoder call.

Implementations§

Source§

impl<S: PackReadSource> BoundedPackDecoder<S>

Source

pub fn new( source: S, format: ObjectFormat, limits: PackReadLimits, ) -> Result<Self, PackReadError>

Source

pub const fn primary_source(&self) -> PackSourceId

Source

pub fn add_source( &mut self, source: S, format: ObjectFormat, ) -> Result<PackSourceId, PackReadError>

Source

pub const fn limits(&self) -> PackReadLimits

Source

pub fn cached_bytes(&self) -> usize

Source

pub fn cached_objects(&self) -> usize

Source

pub fn clear_cache( &mut self, cancel: CancelFlag<'_>, ) -> Result<(), PackReadError>

Drop decoded objects retained between targeted reads, polling between bounded batches. Cancellation may leave a valid partially-cleared cache; its byte accounting and LRU order remain exact for the retained entries.

Source

pub fn read_object_at( &mut self, offset: u64, ref_bases: &RefDeltaBases, ) -> Result<PackReadOutcome, PackReadError>

Decode an entry in the primary source without loading a complete pack.

Source

pub fn read_object_at_with_cancel( &mut self, offset: u64, ref_bases: &RefDeltaBases, cancel: CancelFlag<'_>, ) -> Result<PackReadOutcome, PackReadError>

Source

pub fn read_object_at_location( &mut self, location: PackObjectLocation, ref_bases: &RefDeltaBases, ) -> Result<PackReadOutcome, PackReadError>

Decode an entry in any registered source. REF locations in ref_bases are followed on the same explicit work list as OFS links, keeping stack use constant across cold multi-pack chains.

Source

pub fn read_object_at_location_with_cancel( &mut self, location: PackObjectLocation, ref_bases: &RefDeltaBases, cancel: CancelFlag<'_>, ) -> Result<PackReadOutcome, PackReadError>

Cancel-aware form of Self::read_object_at_location. The flag is polled during chain planning, positional reads, inflate, object-ID hashing, every delta command, and between cache maintenance operations.

Auto Trait Implementations§

§

impl<S> Freeze for BoundedPackDecoder<S>
where Vec<PackSourceState<S>>: Freeze,

§

impl<S> RefUnwindSafe for BoundedPackDecoder<S>
where Vec<PackSourceState<S>>: RefUnwindSafe,

§

impl<S> Send for BoundedPackDecoder<S>
where Vec<PackSourceState<S>>: Send,

§

impl<S> Sync for BoundedPackDecoder<S>
where Vec<PackSourceState<S>>: Sync,

§

impl<S> Unpin for BoundedPackDecoder<S>
where Vec<PackSourceState<S>>: Unpin,

§

impl<S> UnsafeUnpin for BoundedPackDecoder<S>
where Vec<PackSourceState<S>>: UnsafeUnpin,

§

impl<S> UnwindSafe for BoundedPackDecoder<S>
where Vec<PackSourceState<S>>: UnwindSafe,

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, 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.