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>
impl<S: PackReadSource> BoundedPackDecoder<S>
pub fn new( source: S, format: ObjectFormat, limits: PackReadLimits, ) -> Result<Self, PackReadError>
pub const fn primary_source(&self) -> PackSourceId
pub fn add_source( &mut self, source: S, format: ObjectFormat, ) -> Result<PackSourceId, PackReadError>
pub const fn limits(&self) -> PackReadLimits
pub fn cached_bytes(&self) -> usize
pub fn cached_objects(&self) -> usize
Sourcepub fn clear_cache(
&mut self,
cancel: CancelFlag<'_>,
) -> Result<(), PackReadError>
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.
Sourcepub fn read_object_at(
&mut self,
offset: u64,
ref_bases: &RefDeltaBases,
) -> Result<PackReadOutcome, PackReadError>
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.
pub fn read_object_at_with_cancel( &mut self, offset: u64, ref_bases: &RefDeltaBases, cancel: CancelFlag<'_>, ) -> Result<PackReadOutcome, PackReadError>
Sourcepub fn read_object_at_location(
&mut self,
location: PackObjectLocation,
ref_bases: &RefDeltaBases,
) -> Result<PackReadOutcome, PackReadError>
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.
Sourcepub fn read_object_at_location_with_cancel(
&mut self,
location: PackObjectLocation,
ref_bases: &RefDeltaBases,
cancel: CancelFlag<'_>,
) -> Result<PackReadOutcome, PackReadError>
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.