Main decoder for the Gorilla compression algorithm.
This module coordinates the decompression pipeline:
- Extracts and validates metadata header
- Unpacks the combined bitstream into timestamp and value components
- Applies delta-of-delta decoding to timestamps
- Applies XOR-based decompression to values
- Recombines timestamps and values into the original stream
The Gorilla algorithm is specifically designed for time series data with regularly spaced timestamps and slowly changing floating-point values.
Summary
Functions
Decodes compressed binary data back into a stream of {timestamp, float} tuples.
Decodes and validates the result matches expected characteristics.
Pure-Elixir decode, used as fallback when NIF is unavailable.
Estimates decompression performance for given compressed data.
Gets information about compressed data without full decompression.
Returns true if the native NIF decoder is available.
Validates that compressed data can be properly decoded without full decompression.
Functions
Decodes compressed binary data back into a stream of {timestamp, float} tuples.
Parameters
encoded_data: Binary data to decode
Returns
{:ok, decoded_data}: When decoding is successful{:error, reason}: When decoding fails
Decodes and validates the result matches expected characteristics.
Parameters
encoded_data: Binary data to decodevalidation_opts: Optional validation parameters
Returns
{:ok, {stream, stats}}: Decoded stream and statistics{:error, reason}: If decoding or validation fails
Pure-Elixir decode, used as fallback when NIF is unavailable.
Estimates decompression performance for given compressed data.
Parameters
encoded_data: Binary data to analyze
Returns
{:ok, performance_info}: Performance estimates{:error, reason}: If analysis fails
Gets information about compressed data without full decompression.
Parameters
encoded_data: Binary data to analyze
Returns
{:ok, info}with compression information, or{:error, reason}
Returns true if the native NIF decoder is available.
Validates that compressed data can be properly decoded without full decompression.
Parameters
encoded_data: Binary data to validate
Returns
:okif valid,{:error, reason}if invalid