Bandera. Store behaviour
(bandera v0.1.0)
Copy Markdown
Behaviour for the active store the public API talks to.
The concrete store is selected at RUNTIME via Bandera.Config (default
Bandera.Store.TwoLevel). lookup/1 may add caching; writes go to the
persistent layer.
Summary
Callbacks
Returns {:ok, names} with every stored flag name, or {:error, reason}.
Returns {:ok, flags} with every stored flag, or {:error, reason}.
Removes the entire flag and returns the resulting (empty) flag (or {:error, reason}).
Removes a single gate from the flag and returns the updated flag (or {:error, reason}).
Reads a flag by name (may serve from cache). Returns {:ok, flag} or {:error, reason}.
Writes gate onto the flag and returns the updated flag (or {:error, reason}).
Callbacks
Returns {:ok, names} with every stored flag name, or {:error, reason}.
@callback all_flags() :: {:ok, [Bandera.Flag.t()]} | {:error, term()}
Returns {:ok, flags} with every stored flag, or {:error, reason}.
@callback delete(flag_name :: atom()) :: {:ok, Bandera.Flag.t()} | {:error, term()}
Removes the entire flag and returns the resulting (empty) flag (or {:error, reason}).
@callback delete(flag_name :: atom(), gate :: Bandera.Gate.t()) :: {:ok, Bandera.Flag.t()} | {:error, term()}
Removes a single gate from the flag and returns the updated flag (or {:error, reason}).
@callback lookup(flag_name :: atom()) :: {:ok, Bandera.Flag.t()} | {:error, term()}
Reads a flag by name (may serve from cache). Returns {:ok, flag} or {:error, reason}.
@callback put(flag_name :: atom(), gate :: Bandera.Gate.t()) :: {:ok, Bandera.Flag.t()} | {:error, term()}
Writes gate onto the flag and returns the updated flag (or {:error, reason}).
Functions
@spec active() :: module()
The runtime-selected active store module.