Raft v0.2.1 Raft.Server
The Server module provides the raft fsm.
Link to this section Summary
Functions
This defines the child spec correctly
Returns the name of the server that is believed to be the leader. This is not a consistent operation and during a network partition its possible that the server doesn’t know who the latest elected leader is. This function should be used for testing and debugging purposes only
Whenever a GenStateMachine
in callback mode :handle_event_function
(the
default) receives a call, cast, or normal process messsage, this callback will
be invoked
Initializes the state of the server. If log files already exist for this server name then it reads from those files to get the current configuration, term, etc
Reads the current state from the state machine. This is done in a highly consistent manner. Reads must be executed on a leader and the leader must confirm that they have not been deposed before processing the read operation as described in the raft paper, section 8: Client Interaction
Starts a new server
Gets the current status of the server
Applies a new log to the application state machine. This is done in a highly consistent manor. This must be called on the leader or it will fail
Link to this section Types
Link to this section Functions
This defines the child spec correctly
Returns the name of the server that is believed to be the leader. This is not a consistent operation and during a network partition its possible that the server doesn’t know who the latest elected leader is. This function should be used for testing and debugging purposes only.
Whenever a GenStateMachine
in callback mode :handle_event_function
(the
default) receives a call, cast, or normal process messsage, this callback will
be invoked.
This function can optionally throw a result to return it.
See the erlang documentation for a complete reference.
Callback implementation for GenStateMachine.handle_event/4
.
Initializes the state of the server. If log files already exist for this server name then it reads from those files to get the current configuration, term, etc.
Reads the current state from the state machine. This is done in a highly consistent manner. Reads must be executed on a leader and the leader must confirm that they have not been deposed before processing the read operation as described in the raft paper, section 8: Client Interaction.
start_link({Raft.peer(), Raft.Config.t()}) :: {:ok, pid()} | {:error, term()}
Starts a new server.
Gets the current status of the server.
Applies a new log to the application state machine. This is done in a highly consistent manor. This must be called on the leader or it will fail.