RiteRaft - A raft framework, for regular people
This is an attempt to create a layer on top of tikv/raft-rs, that is easier to use and implement. This is not supposed to be the most featureful raft, but instead a convenient interface to get started quickly, and have a working raft in no time.
The interface is strongly inspired by the one used by canonical/raft.
Getting started
In order to "raft" storage, we need to implement the Storage trait for it.
Bellow is an example with HashStore, which is a thread-safe wrapper around an
HashMap:
/// convienient data structure to pass Message in the raft
;
Only 3 methods need to be implemented for the Store:
Store::apply: applies a commited entry to the store.Store::snapshot: returns snapshot data for the store.Store::restore: applies the snapshot passed as argument.
running the raft
The mailbox gives you a way to interact with the raft, for sending a message, or leaving the cluster for example.
Credit
This work is based on raft-frp, but more adjustments and improvements have been made to the code .
License
This library is licensed under either of:
- MIT license LICENSE-MIT or http://opensource.org/licenses/MIT
- Apache License 2.0 LICENSE-APACHE or https://opensource.org/licenses/Apache-2.0
at your option.