PaxosKV.Proposer (paxos_kv v0.3.0)

Summary

Functions

Returns a specification to start this module under a supervisor.

Asks the local Proposer to convince the cluster about a value.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

handle_call(arg, from, state, try_round \\ 1)

propose(key, value, opts)

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}: the value is the chosen (consensus) value for the key
  • {:error, :no_quorum}: there are't enough nodes participating in the cluster
  • {:error, :invalid_value}: the pid or node provided in opts is not alive

start_link(opts)