Skip to content

A varint is the format’s unsigned variable-length integer. It is unsigned LEB128, implemented in crates/strata-lsm/src/varint.rs. It appears throughout the MANIFEST, the SEAM data file and the catalog records.

  • Each byte carries 7 bits of the value. The low 7-bit group comes first.
  • The high bit of each byte is the continuation flag: set means another byte follows, clear means this is the last byte.
  • A varint is at most 10 bytes long.

A reader fails with Corrupt in two cases:

  • the 10th byte still carries the continuation bit, or
  • the input ends before a byte with the continuation bit clear.

Bits of the 10th byte above the lowest one are discarded without error. Writers always emit the shortest form. Readers do not reject non-minimal forms, so a value written with redundant high groups is still accepted.

See Error classes for what Corrupt means.