View Source Nerves.Runtime.KVBackend behaviour (nerves_runtime v0.13.7)

Behaviour for customizing the Nerves Runtime's key-value store

Summary

Callbacks

Load the KV store and return its contents

Persist the updated KV pairs

Callbacks

@callback load(options :: keyword()) ::
  {:ok, contents :: Nerves.Runtime.KV.string_map()} | {:error, reason :: any()}

Load the KV store and return its contents

This will be called on boot and should return all persisted key/value pairs. The results will be cached and if a change should be persisted, save/2 will be called with the update.

@callback save(contents :: Nerves.Runtime.KV.string_map(), options :: keyword()) ::
  :ok | {:error, reason :: any()}

Persist the updated KV pairs

The KV map contains the KV pairs returned by load/1 with any changes made by users of Nerves.Runtime.KV.