An implementation of the Raft distributed consensus protocol using the Tokio framework.
0.6.0
& updated storage interface as needed.The big news for this release is that we are now based on Tokio 1.0! Big shoutout to @xu-cheng for doing all of the heavy lifting for the Tokio 1.0 update, along with many other changes which are part of this release.
It is important to note that 0.6.0 does include two breaking changes from 0.5: the new RaftStorage::ShutdownError
associated type, and Tokio 1.0. Both of these changes are purely code related, and it is not expected that they will negatively impact running systems.
RaftStorage::ShutdownError
associated type. This allows for the Raft system to differentiate between fatal storage errors which should cause the system to shutdown vs errors which should be propagated back to the client for application specific error handling. These changes only apply to the RaftStorage::apply_entry_to_state_machine
method.Debug
bounds requirement on the AppData
& AppDataResponse
types.Raft
type can now be cloned. The clone is very cheap and helps to facilitate async workflows while feeding client requests and Raft RPCs into the Raft instance.Raft.shutdown
interface has been changed slightly. Instead of returning a JoinHandle
, the method is now async and simply returns a result.ClientWriteError::ForwardToLeader
error variant has been modified slightly. It now exposes the data (generic type D
of the type) of the original client request directly. This ensures that the data can actually be used for forwarding, if that is what the parent app wants to do.do_log_compaction
method docs for more details.Raft.current_leader
method. This is a convenience method which builds upon the Raft metrics system to quickly and easily identify the current cluster leader.Raft.current_leader
method. This is a convenience method which builds upon the Raft metrics system to quickly and easily identify the current cluster leader.RaftStorage::ShutdownError
associated type. This allows for the Raft system to differentiate between fatal storage errors which should cause the system to shutdown vs errors which should be propagated back to the client for application specific error handling. These changes only apply to the RaftStorage::apply_entry_to_state_machine
method.PreVote
optimization.Debug
bounds requirement on the AppData
& AppDataResponse
types.Raft
type can now be cloned. The clone is very cheap and helps to facilitate async workflows while feeding client requests and Raft RPCs into the Raft instance.Raft.shutdown
interface has been changed slightly. Instead of returning a JoinHandle
, the method is now async and simply returns a result.ClientWriteError::ForwardToLeader
error variant has been modified slightly. It now exposes the data (generic type D
of the type) of the original client request directly. This ensures that the data can actually be used for forwarding, if that is what the parent app wants to do.do_log_compaction
method docs for more details.