PaxosKV.Proposer (paxos_kv v0.6.0)
Copy MarkdownImplements the Proposer role in the Paxos consensus algorithm.
The Proposer initiates consensus rounds by proposing values to Acceptors. It coordinates the two-phase protocol (prepare and accept phases) to reach consensus on a value for a given key. When contention is detected, it falls back to a primary proposer to ensure liveness.
Summary
Functions
Returns a specification to start this module under a supervisor.
Asks the local Proposer to convince the cluster about a value.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Asks the local Proposer to convince the cluster about a value.
When it detects that there are other Proposer(s) trying to do the same, and the liveness property of Paxos is in danger, it falls back to a primary proposer (running on a node that is determined by the key) instead of the local service.
Return values:
{:ok, value}: thevalueis the chosen (consensus) value for thekey{:error, :no_quorum}: there are't enough nodes participating in the cluster{:error, :invalid_value}: thepidornodeprovided inoptsis not alive