Skip to main content

Module codec

Module codec 

Source
Expand description

Fast-field compression codecs with auto-selection.

Four codecs are available, and the writer picks the smallest at build time:

CodecIDDescription
Constant0No data bytes — all values identical
Bitpacked1min-subtract + global bitpack
Linear2Regression line, bitpack residuals
BlockwiseLinear3Per-512-block linear, bitpack residuals per block

Structs§

BitpackedEstimator
Min-subtract + global bitpack. This is the existing codec, now behind a tag.
BlockwiseLinearEstimator
Per-512-element-block linear interpolation with per-block bitpacked residuals.
ConstantEstimator
All values are identical → zero data bytes. Value stored in the codec header.
LinearEstimator
Fits y = slope * x + intercept across all values, stores residuals bitpacked.

Enums§

CodecType
Codec identifier stored in the column data region (first byte).

Constants§

BLOCKWISE_LINEAR_BLOCK_SIZE
Block size for BlockwiseLinear codec (matching Tantivy).

Traits§

CodecEstimator
Estimates serialized size for a given codec.

Functions§

auto_read
Read a single value from auto-codec encoded data.
auto_read_batch
Batch-read out.len() consecutive values starting at start_index from auto-codec data.
bitpacked_read
Read a single value from a bitpacked-codec column.
bitpacked_read_batch
Batch-read count consecutive values starting at start_index from bitpacked data.
blockwise_linear_read
Read a single value from a blockwise-linear-codec column.
linear_read
Read a single value from a linear-codec column.
serialize_auto
Serialize values using the codec that produces the smallest output.