SharedSettings.Store behaviour (shared_settings v0.2.0)

A behaviour module for persistent store adapters

All data values are represented by strings (similar to Redis). This means that, regardless of what adaptor is being implemented, all adaptors must accept and return data in the format which we will outline.

Storage adaptors are only responsible for storing the setting as-given and returning it in the expected format. Here is a list of formats and their string representation:

number: "1234" string: "any string" boolean: "1" or "0" range: "low,high". eg: "1,5" inclusive

Link to this section Summary

Callbacks

Deletes a setting, identified by name.

Retrieves a setting by name.

Retrieves all settings

Persists a setting

Link to this section Callbacks

Specs

delete(name :: String.t()) :: :ok | {:error, any()}

Deletes a setting, identified by name.

Specs

get(name :: String.t()) :: {:ok, SharedSettings.Setting.t()} | {:error, any()}

Retrieves a setting by name.

Specs

get_all() :: {:ok, [SharedSettings.Setting.t()]}

Retrieves all settings

Specs

put(setting :: SharedSettings.Setting.t()) ::
  {:ok, String.t()} | {:error, any()}

Persists a setting