Fast Static Symbol Tables compression for Elixir.

FSST is a pure Elixir port with an optional Rustler backend planned around fsst-rs. The API follows typical Elixir conventions: train/2 returns {:ok, table} or {:error, reason}, while train!/2, compress!/3, and decompress!/3 raise on failure.

Summary

Functions

Returns the backend module selected for the current options and runtime.

Compresses a binary with a table returned by train/2.

Compresses a binary or raises on failure.

Decompresses a binary with the same table used for compression.

Decompresses a binary or raises on failure.

Trains an FSST table from representative binary samples.

Trains an FSST table or raises when training fails.

Types

reason()

@type reason() ::
  :backend_unavailable
  | :invalid_input
  | :invalid_sample
  | :truncated_escape
  | term()

table()

@type table() :: FSST.Table.t()

Functions

backend(opts \\ [])

@spec backend(keyword()) :: module()

Returns the backend module selected for the current options and runtime.

compress(table, input, opts \\ [])

@spec compress(table(), binary(), keyword()) :: {:ok, binary()} | {:error, reason()}

Compresses a binary with a table returned by train/2.

compress!(table, input, opts \\ [])

@spec compress!(table(), binary(), keyword()) :: binary()

Compresses a binary or raises on failure.

decompress(table, input, opts \\ [])

@spec decompress(table(), binary(), keyword()) :: {:ok, binary()} | {:error, reason()}

Decompresses a binary with the same table used for compression.

decompress!(table, input, opts \\ [])

@spec decompress!(table(), binary(), keyword()) :: binary()

Decompresses a binary or raises on failure.

train(samples, opts \\ [])

@spec train(
  [binary()],
  keyword()
) :: {:ok, table()} | {:error, reason()}

Trains an FSST table from representative binary samples.

train!(samples, opts \\ [])

@spec train!(
  [binary()],
  keyword()
) :: table()

Trains an FSST table or raises when training fails.