Lamina.Server.Impl (lamina v0.2.2)
Separates the functional implementation from the stateful GenServer.
Link to this section Summary
Functions
Query provider
for the latest config_key
.
Initialise the table and server state from the provided options.
If config_value
is volatile, then ask the Lamina server to make sure that it
has the freshest information.
Refreshes all configuration for a provider.
Call config_change/2
on all providers with a function which they can use to
trigger refreshes.
Link to this section Types
config_key()
Specs
config_key() :: atom()
provider()
Specs
provider() :: module()
Link to this section Functions
get_latest_value(provider, config_key, state)
Specs
get_latest_value(provider(), config_key(), Lamina.Server.State.t()) :: {:ok, Lamina.Server.State.t()} | {:ok, Lamina.Server.ConfigValue.t(), Lamina.Server.State.t()} | {:error, any()}
Query provider
for the latest config_key
.
If the provider has a new value, and it is different to the old value, then broadcast the change to subscribers, and call the config module's config_change/3
callback.
init(list)
Specs
init(nonempty_improper_list(module(), keyword())) :: {:ok, Lamina.Server.State.t()} | {:error, any()}
Initialise the table and server state from the provided options.
maybe_get_latest(pid, config_value)
Specs
maybe_get_latest(pid(), Lamina.Server.ConfigValue.t()) :: {:ok, Lamina.Server.ConfigValue.t()} | {:error, any()}
If config_value
is volatile, then ask the Lamina server to make sure that it
has the freshest information.
refresh_provider(provider, state)
Specs
refresh_provider(provider(), Lamina.Server.State.t()) :: {:ok, Lamina.Server.State} | {:error, any()}
Refreshes all configuration for a provider.
set_provider_config_change_callbacks(state)
Specs
set_provider_config_change_callbacks(Lamina.Server.State.t()) :: {:ok, Lamina.Server.State} | {:error, any()}
Call config_change/2
on all providers with a function which they can use to
trigger refreshes.