Skip to main content

Module varint

Module varint 

Source
Expand description

Go-compatible varint decoding (binary.PutUvarint / PutVarint).

Prometheus uses Go’s unsigned LEB128 and zig-zag signed varints in both the index format and chunk bit streams. Error behaviour follows Go’s binary.Uvarint: overflow and truncation are reported separately.

Constants§

MAX_VARINT_LEN
Maximum bytes a 64-bit varint can occupy.

Functions§

peek_uvarint
Reads a varint without advancing pos, returning (value, next_pos).
uvarint
Reads an unsigned LEB128 varint, advancing pos.
uvarint32
Upper bound for a 32-bit length field (used by index sections).
varint
Reads a zig-zag encoded signed varint, advancing pos.