ETS-backed storage for node-local configuration parameters.
Node-local settings are NOT replicated via Raft and are NOT persisted
by CONFIG REWRITE. They are intentionally ephemeral -- on restart,
all local settings are lost.
Supported parameters
"log_level"-- maps toLogger.configure(level: level). Valid values:"debug","info","notice","warning","error".
Usage
Ferricstore.Config.Local.set("log_level", "debug")
#=> :ok
Ferricstore.Config.Local.get("log_level")
#=> {:ok, "debug"}
Ferricstore.Config.Local.get_all()
#=> %{"log_level" => "debug"}
Summary
Functions
Ensures the local config ETS table exists.
Returns the current value of a node-local configuration parameter.
Returns all explicitly set local configuration parameters as a map.
Clears all local configuration settings.
Sets a node-local configuration parameter.
Types
Functions
@spec ensure_table() :: :ok
Ensures the local config ETS table exists.
Called during application startup. Safe to call multiple times.
@spec get(param_name()) :: {:ok, param_value()} | {:error, binary()}
Returns the current value of a node-local configuration parameter.
If the parameter has not been explicitly set via CONFIG SET LOCAL,
returns the effective current value from the runtime (e.g. the current
Logger level).
Parameters
key-- parameter name
Returns
{:ok, value}when the parameter is known{:error, reason}when the parameter is unknown
Examples
iex> Ferricstore.Config.Local.get("log_level")
{:ok, "warning"}
@spec get_all() :: %{required(param_name()) => param_value()}
Returns all explicitly set local configuration parameters as a map.
Parameters that have not been explicitly set are not included.
Returns
A map of %{param_name => param_value}.
@spec reset_all() :: :ok
Clears all local configuration settings.
Does NOT revert side-effects (e.g. Logger level stays at whatever it
was last set to). The next get/1 call will read the live value.
@spec set(param_name(), param_value()) :: :ok | {:error, binary()}
Sets a node-local configuration parameter.
Validates the parameter name and value. Applies the corresponding side-effect (e.g. configuring the Logger level).
Parameters
key-- parameter name (e.g."log_level")value-- new value as a string
Returns
:okon success{:error, reason}when the parameter is unknown or the value is invalid
Examples
iex> Ferricstore.Config.Local.set("log_level", "debug")
:ok
iex> Ferricstore.Config.Local.set("bogus", "value")
{:error, "ERR Unsupported local CONFIG parameter: bogus"}