Leader election contract (design §5.1, implementation.md §3). An adapter is started per instance and campaigns on behalf of its node; it notifies the configured pid with
{:fief_leadership, :elected, term}
{:fief_leadership, :deposed}Terms are monotonic per namespace: a new election never reuses or lowers a
term, which is what makes term validation in Fief.StateStore.cas_assign/5
a fence against zombie planners.
Summary
Types
@type leader_term() :: pos_integer()
@type provider() :: GenServer.server()
Callbacks
@callback leader(provider()) :: {:ok, {node_id :: term(), leader_term()}} | {:error, :none}
Current leader, if any.
@callback start_link(opts :: keyword()) :: GenServer.on_start()