Skip to main content

Module chunks

Module chunks 

Source
Expand description

Chunk segment access.

Layout per segment (see tsdb/docs/format/chunks.md): magic(4) version(1) padding(3), then repeated records of len(uvarint) encoding(1) data(len) crc32c(4).

len counts the chunk body only: it excludes the encoding byte and the trailing CRC. The CRC covers the encoding byte followed by the body, i.e. crc32c(encoding || data).

Time-range selection of a series’ chunks lives in range.

A chunk reference is (segment << 32) | offset. The segment half is a 0-based position in the segment file list, not the numeric file name: Prometheus names the first file 000001 but writes 0 into every reference. Files must therefore be contiguous, which ChunkReader::open enforces.

Re-exports§

pub use range::chunk_index_range;
pub use range::chunks_in_range;

Modules§

range
Chunk selection by time range.
validation
Structural checks for chunk segments.

Structs§

ChunkReader
A block’s chunks/ directory, one segment per numeric file.
ChunkSlice
A zero-copy view of one chunk record inside a segment.

Constants§

SEGMENT_HEADER_SIZE
Size of a chunk segment header: magic(4) + version(1) + padding(3).