pub struct ResumeState { /* private fields */ }lsm only.Expand description
Cross-block decode state needed to resume a cold partial decode at an inner
block boundary, emitted by FrameDecoder::decode_blocks_partial when its
emit_resume argument is true (returned in
PartialDecode::resume_state) and fed back via that same method’s
resume argument
(ResumeInput).
A zstd block does not carry all the state required to decode it in
isolation: besides the shared match window (the decompressed output history),
a Compressed block may reuse the previous block’s entropy tables via
Repeat_Mode (literals Huffman + the LL/OF/ML FSE distributions) and always
continues the running repeat-offset history. This snapshot carries exactly
that carry-over state plus the resume coordinates, so resuming is
byte-identical to a contiguous decode even across a dropped decoder. The
window itself is NOT stored here — the caller supplies it back through
ResumeInput::window_prime from the decompressed output it already
persists. Neither is the dictionary: for a dictionary frame the caller
re-attaches it to the resuming decoder via FrameDecoder::reset /
FrameDecoder::reset_with_dict_handle (it already holds the dictionary
from encode time), and the snapshot records only the dictionary’s identity
so a resume under a different dictionary is rejected.
Behind the lsm Cargo feature.
Implementations§
Source§impl ResumeState
impl ResumeState
Sourcepub fn block_index(&self) -> u32
pub fn block_index(&self) -> u32
Inner block index this state resumes at (the first block not yet
decoded). Pass it as the end_block lower bound (and as start_block)
of the resuming
decode_blocks_partial call.
Sourcepub fn output_offset(&self) -> u64
pub fn output_offset(&self) -> u64
Cumulative decompressed byte count produced before
block_index — i.e. the decompressed offset at
which the resumed output begins. Equals
FrameEmitInfo::decompressed_byte_range(block_index).start. Use it to
slice the window_prime tail the resumed call needs.