Expand description
Sequences that come into the encoder from outside, or go out of it: a parse
of the input into literal runs and matches, laid out as the C
ZSTD_Sequence so the C entry points pass caller arrays straight through.
SequenceReplayis aMatcherthat searches nothing and reports a given parse instead, so a frame is built from it by the ordinary block pipeline (CZSTD_compressSequences).SequenceProduceris a parser asked for each block in place of the built-in match finder (CZSTD_registerSequenceProducer).FrameCompressor::set_sequence_capturerecords the parse the built-in match finder chose (CZSTD_generateSequences).
Structs§
- External
Sequence - One sequence of a parse:
lit_lenliteral bytes, thenmatch_lenbytes copied fromoffsetbytes back. A sequence withoffset == 0andmatch_len == 0carries only literals and ends a block (a block delimiter). Laid out as the CZSTD_Sequence. - Rebuilt
Source - The input a parse decodes to, rebuilt from its literals as it is read, as
a decoder would (C
ZSTD_compressSequencesAndLiteralstakes the literals rather than the input). Matches reaching before the start read fromdict; literals past the last sequence are the trailing ones. Only the lastwindowbytes are held for the matches to copy from (more only while a match reaching further, into the dictionary, is being copied), so a frame is built from it without the whole input in memory. - Sequence
Producer Error - Why a
SequenceProducergave no parse for a block. - Sequence
Replay - A
Matcherthat reports a given parse instead of searching, so the ordinary block pipeline builds a frame from it (CZSTD_compressSequences). The parse is consumed as blocks are cut: wherever the encoder ends a block, a sequence running across the cut is split there, and a match piece shorter thanMIN_MATCHgoes out as literals. Block delimiters, if any, end blocks: each delimited region is a block of its own, cut further only where it exceeds the block size.
Enums§
- Sequence
Error - Why a parse cannot build a valid frame.
Constants§
- MIN_
MATCH - The shortest match a sequence can carry (RFC 8878 3.1.1.3.2.1.1: match length codes start at 3).
Traits§
- Sequence
Producer - A parser asked for each block in place of the built-in match finder (C
ZSTD_registerSequenceProducer). Its parse covers the block alone, with no history before it.
Functions§
- merge_
block_ delimiters - Remove every block delimiter from
sequences, handing its literals to the sequence after it, and return how many sequences remain at the front (CZSTD_mergeBlockDelimiters). A final delimiter’s literals become the parse’s trailing literals, which no sequence carries. - parse_
reproduces - Check that
sequencesdecodes tosrc: every match copies the bytes the input holds where it lands, out ofsrcitself or, reaching before the start, out of the tail ofdict. A parse thatvalidate_parseaccepts can still describe different bytes; compressing it would make a frame that decodes to them, not tosrc. - producer_
parse_ heap_ bytes - Heap bytes a compressor keeps for a
SequenceProducer’s parse of blocks up toblock_sizebytes: room forsequence_boundsequences, as many as a parse it can use holds, kept from block to block (upstream reserves the same for its external sequences, zstd_compress.c:2236-2239). - sequence_
bound - Upper bound on the sequences a parse of
src_sizebytes can hold, block delimiters included (CZSTD_sequenceBound): one per minimal match, and one delimiter per smallest block. - validate_
parse - Check that
sequencesis a parse ofsrc_lenbytes a decoder can follow: every match at leastMIN_MATCHbytes (literals with no match are a delimiter, offset 0), every offset within what is decoded so far plusdict_lenbytes of dictionary while that fits the window, and withinwindowafter. Withexplicit_delimitersthe parse must cover the input exactly and each delimited block hold at mostmax_blockbytes; without, bytes past the parse are trailing literals.