Lamina.Server.Table (lamina v0.2.2)
A wrapper around ETS for our specific use cases.
Link to this section 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.
Link to this section Types
lifetime()
Specs
lifetime() :: Lamina.Provider.lifetime()
provider()
Specs
provider() :: module()
Specs
t() :: :ets.tid()
value()
Specs
value() :: any()
Link to this section Functions
expire(table)
Specs
expire(t()) :: :ok
Delete any expired rows from the ETS table.
get(table, config_key)
Specs
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)
Specs
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)
Specs
insert(t(), [Lamina.Server.ConfigValue.t()]) :: :ok
Insert any number of configuration values into the ETS table.
new(module)
Specs
Initialises a new ETS table.
remove(table, provider, config_key)
Specs
Remove matching configuration values from the ETS table.