Runtime codec registry for ExCodecs.
The registry maintains a mapping of codec names to their implementations and metadata. Codecs are registered at application startup and can be queried at runtime.
Registry Operations
iex> ExCodecs.available_codecs()
[:blosc2, :bzip2, :lz4, :snappy, :zstd]
iex> ExCodecs.supports?(:zstd)
true
iex> {:ok, info} = ExCodecs.codec_info(:zstd)
iex> info.name
:zstdThe registry is backed by an ETS table for fast lookups and is populated when the application starts.
Summary
Functions
Returns all registered codec names (including unavailable ones).
Returns a list of all available codec names.
Returns a specification to start this module under a supervisor.
Returns detailed information about a codec.
Returns all codecs in a given category.
Looks up a codec by name.
Registers a codec with the registry.
Registers a codec as unavailable (known but not loadable).
Starts the registry agent.
Checks if a codec is supported and available.
Functions
@spec all_codecs() :: [atom()]
Returns all registered codec names (including unavailable ones).
@spec available_codecs() :: [atom()]
Returns a list of all available codec names.
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec codec_info(atom()) :: {:ok, ExCodecs.Codec.t()} | {:error, :unsupported_codec}
Returns detailed information about a codec.
@spec codecs_by_category(atom()) :: [ExCodecs.Codec.t()]
Returns all codecs in a given category.
@spec lookup(atom()) :: {:ok, {module(), atom(), ExCodecs.Codec.t()}} | {:error, :unsupported_codec}
Looks up a codec by name.
Returns
{:ok, {module, category, info}}- Codec found{:error, :unsupported_codec}- Codec not found
Registers a codec with the registry.
Arguments
name- The atom name of the codec (e.g.,:zstd)module- The module implementingExCodecs.Codeccategory- The codec category (e.g.,:compression)
Returns
:ok- Codec registered successfully{:error, reason}- Registration failed
@spec start_link(keyword()) :: Agent.on_start()
Starts the registry agent.
Checks if a codec is supported and available.