GorillaStream.Compression.Encoder.Metadata (gorilla_stream v3.0.3)

Copy Markdown View Source

Metadata handling module for adding metadata to compressed data in Gorilla compression.

This module handles the creation and serialization of metadata that describes the compressed data format, compression parameters, and other information needed for proper decompression.

The metadata format includes:

  • Magic number for format identification
  • Version information
  • Compression parameters
  • Data statistics
  • Checksum for integrity verification

Summary

Functions

Adds metadata to packed data.

Extracts basic information from metadata header without full parsing.

Validates metadata header format.

Functions

add_metadata(packed_data, metadata)

Adds metadata to packed data.

Parameters

  • packed_data: Binary data to add metadata to
  • metadata: Map containing metadata information from bit packing

Returns

  • Binary data with metadata header prepended

get_header_info(binary)

Extracts basic information from metadata header without full parsing.

Parameters

  • binary: Binary data starting with metadata header

Returns

  • {:ok, info_map} with basic info, or {:error, reason}

validate_metadata_header(binary)

Validates metadata header format.

Parameters

  • binary: Binary data that should start with metadata header

Returns

  • :ok if valid, {:error, reason} if invalid