# bandera v0.2.0 - Table of Contents

> Feature flag library with runtime config for storage backends and caching.

## GUIDES

- [Bandera](readme.md)
- [Changelog](changelog.md)

- Guides
  - [Using Bandera with Phoenix LiveView](phoenix_liveview_guide.md)
  - [Flag Dashboard (LiveView UI)](dashboard_guide.md)
  - [Migration from fun_with_flags](migration_guide.md)

## Modules

- [Bandera](Bandera.md): Runtime-configured feature flags, API-compatible with fun_with_flags.
- [Bandera.Config](Bandera.Config.md): Resolves all Bandera settings at RUNTIME and caches them in a `:persistent_term`
snapshot for cheap hot-path reads.
- [Bandera.Flag](Bandera.Flag.md): A named feature flag (a collection of gates) and its evaluation.
- [Bandera.Gate](Bandera.Gate.md): A single feature-flag gate and its evaluation.
- [Bandera.Telemetry](Bandera.Telemetry.md): Telemetry events for Bandera.

- Stores
  - [Bandera.Store](Bandera.Store.md): Behaviour for the active store the public API talks to.
  - [Bandera.Store.Cache](Bandera.Store.Cache.md): ETS read cache for flags. Always started; bypassed by the store when the cache
is disabled (so the cache can be toggled at runtime without races). The TTL is
read from the runtime `Bandera.Config` snapshot at lookup time.
  - [Bandera.Store.ProcessScoped](Bandera.Store.ProcessScoped.md): Process-scoped overlay store for tests, backed by `NimbleOwnership`.
  - [Bandera.Store.TwoLevel](Bandera.Store.TwoLevel.md): Default store: an ETS cache in front of a persistent adapter. Whether the cache
is consulted is decided per-call from the runtime `Bandera.Config` snapshot
(read from `:persistent_term`), so caching can be toggled at runtime with no
recompilation. The persistent adapter is also runtime-selected.

- Persistence
  - [Bandera.Ecto.Migrations](Bandera.Ecto.Migrations.md): Helpers for creating the Bandera flags table. Call from your own migration
  - [Bandera.Store.Persistent](Bandera.Store.Persistent.md): Behaviour for durable flag storage adapters (Memory, Ecto, Redis).
  - [Bandera.Store.Persistent.Ecto](Bandera.Store.Persistent.Ecto.md): SQL persistence adapter. The repo and table name are read from
`Bandera.Config` at RUNTIME and queries bind the table via Ecto's
`{table_name, Record}` source form, so nothing about the table is fixed at
compile time. The `Record` schema supplies field types so values (e.g.
booleans) cast portably across SQL backends.
  - [Bandera.Store.Persistent.Memory](Bandera.Store.Persistent.Memory.md): In-memory (ETS) persistence adapter. The default backend; suitable for
single-node deployments and development. Not durable across restarts.
  - [Bandera.Store.Persistent.Redis](Bandera.Store.Persistent.Redis.md): Redis persistence adapter (via Redix).

- Notifications
  - [Bandera.Notifications](Bandera.Notifications.md): Cross-node cache-busting notifications.
  - [Bandera.Notifications.PhoenixPubSub](Bandera.Notifications.PhoenixPubSub.md): Phoenix.PubSub cache-busting notifier. Subscribes to a topic and, on a flag
change broadcast by ANOTHER node, busts the local cache entry. Self-published
changes are ignored. The PubSub server name is read at runtime from
`config :bandera, cache_bust_notifications: [client: MyApp.PubSub]`.

  - [Bandera.Notifications.Redis](Bandera.Notifications.Redis.md): Redis PubSub cache-busting notifier (via Redix). Subscribes to a channel and,
on a flag change published by ANOTHER node, busts the local cache entry for
that flag. Self-published changes are ignored. Connection options are read at
runtime from `config :bandera, cache_bust_notifications: [redis: <Redix opts>]`.

- Protocols
  - [Bandera.Actor](Bandera.Actor.md): Identifies an actor (e.g. a user) for actor and percentage_of_actors gates.
The id must be a binary and stable for a given actor across a flag's lifetime.
  - [Bandera.Group](Bandera.Group.md): Determines whether a given item (actor) belongs to a named group.
Group names are compared as strings.

- Dashboard
  - [Bandera.Dashboard.Components](Bandera.Dashboard.Components.md): Function components for the Bandera dashboard.
  - [Bandera.Dashboard.FlagsLive](Bandera.Dashboard.FlagsLive.md): The Bandera flag dashboard LiveView.
  - [Bandera.Dashboard.Grouping](Bandera.Dashboard.Grouping.md): Pure helper that groups flags for the dashboard by a name-prefix convention.
  - [Bandera.Dashboard.Router](Bandera.Dashboard.Router.md): Router macro for mounting the Bandera dashboard.
  - [Bandera.Dashboard.Theme](Bandera.Dashboard.Theme.md): Maps a dashboard element's semantic *role* to a CSS class string for the active
theme. The LiveView markup is identical across themes; only the class strings
differ, so there is a single template and no fork.

- Testing
  - [Bandera.Test](Bandera.Test.md): Test helpers for toggling Bandera flags with per-test, async-safe isolation.

- Exceptions
  - [Bandera.Gate.InvalidTargetError](Bandera.Gate.InvalidTargetError.md): Raised when a percentage gate is built with a ratio outside `0.0 < r < 1.0`.

