Raft v0.1.0 Raft.Server
Link to this section Summary
Functions
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
TODO: Implement this workflow.
- Pull logs out of storage
- Pull current term out of storage
- Set a new election timeout
- Find the most recent config change (start from most recent snapshot if we have one)
- Restore state:
- set last index
- set last_log
- set current term
- set the configuration
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
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.
TODO: Implement this workflow.
- Pull logs out of storage
- Pull current term out of storage
- Set a new election timeout
- Find the most recent config change (start from most recent snapshot if we have one)
- Restore state:
- set last index
- set last_log
- set current term
- set the configuration
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.