Skip to main content

Module gorilla

Module gorilla 

Source
Expand description

Gorilla XOR encoding for floating-point timeseries metrics.

Implements the Facebook Gorilla paper’s XOR-based compression for double-precision floating-point values. Achieves ~1.5 bytes per 16-byte (timestamp + value) sample by exploiting temporal locality in metric streams.

Also usable for non-monotonic i64 values by casting through f64 bits.

Wire format:

[4 bytes] sample count (LE u32)
[N bytes] bitstream: first sample raw (64+64 bits), then delta-of-delta
          timestamps + XOR-compressed values

Reference: “Gorilla: A Fast, Scalable, In-Memory Time Series Database” (Pelkonen et al., VLDB 2015)

Structs§

GorillaDecoder
Gorilla XOR decoder for (timestamp, f64) sample streams.
GorillaEncoder
Gorilla XOR encoder for (timestamp, f64) sample streams.

Functions§

decode_f64
Decode Gorilla-compressed f64 values (encoded with encode_f64).
decode_timestamps
Decode Gorilla-encoded timestamps.
encode_f64
Encode a slice of f64 values using Gorilla XOR compression.
encode_timestamps
Encode a slice of i64 timestamps using Gorilla (value channel unused).