pub struct PositionalBlockDecoder { /* private fields */ }Expand description
An owned block decode that can move to a caller’s worker pool.
Every decode owns an independent positional cursor. The archive and password
are shared without cloning their contents; sharing the same Arc<Password>
also shares its lifetime KDF budget and derived-key cache. No worker is
spawned until a codec’s explicitly requested thread count requires one.
The source must provide the same archive image that was parsed. A streaming
consumer is responsible for admitting only covered packed ranges and for
invalidating or cancelling work when those bytes are replaced by repair.
Callback errors stop the decode and pass through unchanged, as they do for
BlockDecoder. Codec workers are joined when their decode stack drops.
Implementations§
Source§impl PositionalBlockDecoder
impl PositionalBlockDecoder
Sourcepub fn new(
archive: Arc<Archive>,
password: Arc<Password>,
source: Arc<dyn ReadAt>,
block_index: usize,
) -> Result<Self, Error>
pub fn new( archive: Arc<Archive>, password: Arc<Password>, source: Arc<dyn ReadAt>, block_index: usize, ) -> Result<Self, Error>
Prepares one block over a parsed archive and an independent cursor.
Defaults to one codec thread and checksum verification. This allocates no decoder dictionary and reads no packed bytes until the entry walk.
§Errors
Returns an error if block_index is outside the parsed archive or its
data members are interspersed with no-stream entries. The latter cannot
be represented by the underlying block walk and requires another path.
Sourcepub fn with_limits(
archive: Arc<Archive>,
password: Arc<Password>,
source: Arc<dyn ReadAt>,
block_index: usize,
limits: ArchiveLimits,
) -> Result<Self, Error>
pub fn with_limits( archive: Arc<Archive>, password: Arc<Password>, source: Arc<dyn ReadAt>, block_index: usize, limits: ArchiveLimits, ) -> Result<Self, Error>
As Self::new, enforcing the same decoder and KDF limits as
BlockDecoder::with_limits. Concurrent decodes each obey these limits;
the caller must also bound their combined memory and worker count.
§Errors
As Self::new.
Sourcepub fn set_threads(&mut self, threads: u32)
pub fn set_threads(&mut self, threads: u32)
Sets this block’s codec thread count, clamped to 1..=256.
Sourcepub fn with_threads(self, threads: u32) -> Self
pub fn with_threads(self, threads: u32) -> Self
Self::set_threads for a builder chain.
Sourcepub fn with_adaptive_lzma2(self) -> Self
pub fn with_adaptive_lzma2(self) -> Self
Enables later LZMA2 widening through Self::lzma2_handle.
Sourcepub fn with_verify_checksums(self, verify: bool) -> Self
pub fn with_verify_checksums(self, verify: bool) -> Self
Controls checksum verification, as on BlockDecoder.
Sourcepub fn lzma2_handle(&self) -> Lzma2Handle
pub fn lzma2_handle(&self) -> Lzma2Handle
Returns the control handle that remains usable while this decode runs.
Sourcepub fn set_sub_stream_complete_hook(
&mut self,
hook: impl FnMut(SubStreamCompletion) + Send + 'static,
)
pub fn set_sub_stream_complete_hook( &mut self, hook: impl FnMut(SubStreamCompletion) + Send + 'static, )
Installs the verified sub-stream completion hook for this block. Hooks run on the thread executing the entry walk, in file order.
Sourcepub fn entries(&self) -> &[ArchiveEntry]
pub fn entries(&self) -> &[ArchiveEntry]
Entries in this block, in archive order.
Sourcepub fn for_each_entries<F>(self, each: &mut F) -> Result<bool, Error>
pub fn for_each_entries<F>(self, each: &mut F) -> Result<bool, Error>
Decodes on the calling thread, with ordinary Read callbacks.
Returns false when a callback stops the walk early.
§Errors
The same located codec/checksum errors and unchanged callback errors
as BlockDecoder::for_each_entries.