Main encoder for the Gorilla compression algorithm.
This module coordinates the compression pipeline:
- Separates timestamps and values from the input stream
- Applies delta-of-delta encoding to timestamps
- Applies XOR-based compression to values
- Packs both bitstreams together
- Adds metadata header
The Gorilla algorithm is specifically designed for time series data with regularly spaced timestamps and slowly changing floating-point values.
Summary
Functions
Encodes a stream of {timestamp, float} tuples using the Gorilla compression algorithm.
Pure-Elixir encode, used as fallback when NIF is unavailable.
Estimates the compression ratio for given data without full compression.
Returns true if the native NIF encoder is available.
Functions
Encodes a stream of {timestamp, float} tuples using the Gorilla compression algorithm.
This is an optimized implementation that skips some validation checks for better performance. Input data is assumed to be valid {timestamp, float} tuples.
Parameters
data: List of {timestamp, float} tuples
Returns
{:ok, encoded_data}: When encoding is successful{:error, reason}: When encoding fails
Pure-Elixir encode, used as fallback when NIF is unavailable.
Estimates the compression ratio for given data without full compression.
This is useful for determining if Gorilla compression would be beneficial for a particular dataset.
Parameters
data: List of {timestamp, float} tuples
Returns
{:ok, estimated_ratio}: Estimated compression ratio (compressed_size / original_size){:error, reason}: If estimation fails
Returns true if the native NIF encoder is available.