Raft v0.2.1 Raft.Configuration

Defines a struct and common operations for managing cluster membership

Link to this section Summary

Functions

Gets a list of followers

Does the server have a vote

Determines if we have a majority based on the current configuration

Is the peer a member of the configuration

Gets the maximum index for which we have a quorum

Reconfigures the configuration with new servers. If the configuration state is :none then it moves directly into a stable configuration. Otherwise it starts to transition to a new configuration

Returns the list of all servers based on the configuration state

Builds a new voter server server struct

Link to this section Types

Link to this type config_state()
config_state() :: :none | :stable | :staging | :transitional
Link to this type peer()
peer() :: atom() | {atom(), atom()}
Link to this type t()
t() :: %Raft.Configuration{
  index: term(),
  new_servers: list(),
  old_servers: list(),
  state: config_state()
}

Link to this section Functions

Gets a list of followers

Link to this function has_vote?(me, map)
has_vote?(peer(), Raft.Configuration.t()) :: boolean()

Does the server have a vote.

Link to this function majority?(configuration, votes)

Determines if we have a majority based on the current configuration.

Link to this function member?(configuration, peer)
member?(Raft.Configuration.t(), peer()) :: boolean()

Is the peer a member of the configuration.

Link to this function next(config, change)
Link to this function next(atom, config, change)
Link to this function quorum_max(configuration, indexes)
quorum_max(Raft.Configuration.t(), map()) :: non_neg_integer()

Gets the maximum index for which we have a quorum.

Link to this function rebuild_configuration(log, configuration)
Link to this function reconfig(config, new_servers)

Reconfigures the configuration with new servers. If the configuration state is :none then it moves directly into a stable configuration. Otherwise it starts to transition to a new configuration.

Returns the list of all servers based on the configuration state.

Link to this function voter(name, address)

Builds a new voter server server struct.