# `Bandera.Store`

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.

# `all_flag_names`

```elixir
@callback all_flag_names() :: {:ok, [atom()]} | {:error, term()}
```

Returns `{:ok, names}` with every stored flag name, or `{:error, reason}`.

# `all_flags`

```elixir
@callback all_flags() :: {:ok, [Bandera.Flag.t()]} | {:error, term()}
```

Returns `{:ok, flags}` with every stored flag, or `{:error, reason}`.

# `delete`

```elixir
@callback delete(flag_name :: atom()) :: {:ok, Bandera.Flag.t()} | {:error, term()}
```

Removes the entire flag and returns the resulting (empty) flag (or `{:error, reason}`).

# `delete`

```elixir
@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}`).

# `lookup`

```elixir
@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}`.

# `put`

```elixir
@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}`).

# `active`

```elixir
@spec active() :: module()
```

The runtime-selected active store module.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
