API Reference bandera v#0.1.0
Copy MarkdownModules
Runtime-configured feature flags, API-compatible with fun_with_flags.
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.
Resolves all Bandera settings at RUNTIME and caches them in a :persistent_term
snapshot for cheap hot-path reads.
Helpers for creating the Bandera flags table. Call from your own migration
A named feature flag (a collection of gates) and its evaluation.
A single feature-flag gate and its evaluation.
Raised when a percentage gate is built with a ratio outside 0.0 < r < 1.0.
Determines whether a given item (actor) belongs to a named group. Group names are compared as strings.
Cross-node cache-busting notifications.
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].
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>].
Behaviour for the active store the public API talks to.
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.
Behaviour for durable flag storage adapters (Memory, Ecto, Redis).
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.
Ecto schema for a single flag-gate row. The schema "bandera_flags" source is
only a placeholder/default; the adapter always overrides it at query time via
{Bandera.Config.ecto_table_name(), Record}, so the table name stays runtime
configured (no compile-time table config). The schema exists purely to give
Ecto the field types needed for portable casting (e.g. booleans) across SQL
backends.
Pure mapping between Bandera.Gates and SQL table rows.
In-memory (ETS) persistence adapter. The default backend; suitable for single-node deployments and development. Not durable across restarts.
Redis persistence adapter (via Redix).
Pure mapping between Bandera.Gates and Redis hash {field, value} pairs.
Process-scoped overlay store for tests, backed by NimbleOwnership.
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.
Telemetry events for Bandera.
Test helpers for toggling Bandera flags with per-test, async-safe isolation.