nerves_runtime v0.9.2 Nerves.Runtime.KV behaviour

Key Value Storage for firmware variables provided by fwup

KV provides access to metadata variables set by fwup. It can be used to obtain information such as the active firmware slot, where the application data partition is located, etc.

Values are stored in two ways.

  • Values that do not pertain to a specific firmware slot For example: "nerves_fw_active" => "a"

  • Values that pertain to a specific firmware slot For Example: "a.nerves_fw_author" => "The Nerves Team"

You can find values for just the active firmware slot by using get_active and get_all_active. The result of these functions will trim the firmware slot ("a." or "b.") from the leading characters of the keys returned.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor

Get the key regardless of firmware slot

Get the key for only the active firmware slot

Get all keys regardless of firmware slot

Get all key value pairs for only the active firmware slot

Start the KV store server

Link to this section Functions

Link to this function child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function get(key)
get(String.t()) :: String.t() | nil

Get the key regardless of firmware slot

Link to this function get_active(key)
get_active(String.t()) :: String.t() | nil

Get the key for only the active firmware slot

Link to this function get_all()
get_all() :: map()

Get all keys regardless of firmware slot

Link to this function get_all_active()
get_all_active() :: map()

Get all key value pairs for only the active firmware slot

Link to this function start_link(opts)
start_link(any()) :: GenServer.on_start()

Start the KV store server

Link to this section Callbacks

Link to this callback init(opts)
init(opts :: any()) :: initial_state :: map()