Lamina. Server. Table
(lamina v0.4.4)
Copy Markdown
A wrapper around ETS for our specific use cases.
Summary
Functions
Delete any expired rows from the ETS table.
Find the most likely configuration value for a given configuration key.
Get a specific configuration value from the ETS table.
Insert any number of configuration values into the ETS table.
Initialises a new ETS table.
Remove matching configuration values from the ETS table.
Types
@type lifetime() :: Lamina.Provider.lifetime()
@type provider() :: module()
@type t() :: :ets.tid()
@type value() :: any()
Functions
@spec expire(t()) :: :ok
Delete any expired rows from the ETS table.
@spec get(t(), atom()) :: {:ok, Lamina.Server.ConfigValue.t()} | {:error, Lamina.Error.ConfigNotFoundError.t()}
Find the most likely configuration value for a given configuration key.
This executes a gently complicated match spec against the ETS table to find a configuration value which has the highest provider priority and is not expired.
@spec get(t(), atom(), provider()) :: {:ok, Lamina.Server.ConfigValue.t()} | {:error, Lamina.Error.ConfigNotFoundError.t()}
Get a specific configuration value from the ETS table.
Searches by config_key and provider only - does not take into account
the row's expiry time.
@spec insert(t(), [Lamina.Server.ConfigValue.t()]) :: :ok
Insert any number of configuration values into the ETS table.
Initialises a new ETS table.
Remove matching configuration values from the ETS table.