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).
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.
Modules§
- validation
- Structural checks for chunk segments.
Structs§
- Chunk
Reader - A block’s
chunks/directory, one segment per numeric file. - Chunk
Slice - 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).