Lamina.Server.Table (lamina v0.4.2)
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
lifetime()
@type lifetime() :: Lamina.Provider.lifetime()
provider()
@type provider() :: module()
@type t() :: :ets.tid()
value()
@type value() :: any()
Functions
expire(table)
@spec expire(t()) :: :ok
Delete any expired rows from the ETS table.
get(table, config_key)
@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.
get(table, config_key, provider)
@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.
insert(table, config_values)
@spec insert(t(), [Lamina.Server.ConfigValue.t()]) :: :ok
Insert any number of configuration values into the ETS table.
new(module)
Initialises a new ETS table.
remove(table, provider, config_key)
Remove matching configuration values from the ETS table.