The, not released yet, simplest Rust library to replicate anything over the network.
There is many replication libraries in the Rust ecosystem but is there any one that is easy enough to use that anybody achieved to use it? And somebody that is not already the author of the replication library itself?
I don't think so!
Just look at the complexity of use of the most popular Raft library developped by PingCAP:
- You have to manage the Raft logic yourself, in your own loop.
- You have to deal with the Protocol Buffer messages.
Yes, I am talking about the Go programming language here, and more particularly about state replication over the network. The most popular library for replicating states is the HashiCorp one and why?
Look how easy it is:
- You just have to follow the
FSM
interface. - Your state will be replicated any time you call
raft.Apply
.
That is just pure magic 🧙♀️💫
The canonical raft library was mostly inspired by the HashiCorp one, and therefore inhertis its simple interface where only three functions can be implemented.
This is why we must wrap it in the safest and easiest way as possible to make the Rust community proud of its replication ecosystem!
Canonical-raft is based on the raft library developed by canonical and the most important limitation is that it requires Linux. This limitation is due to the fact that it uses the AIO API for disk I/O, which is only available on Linux, a pull request is opened to remove this limitation.
One other restraining element is that the currently provided raft_io
runtime is based on libuv
which is not the commonly used asynchronous runtime we use in the Rust community.
- [ ] #1 Create a safe abstraction on top of the bindings from canonical-raft-sys.
- [ ] #2 Create a
raft_io
interface that could run on top of any async runtime. - [ ]
#3 Create a canonical-raft-mdb akin to the.MDBstore
of HashiCorp
This is a Rust library, you must make sure to have the toolchain installed.
As it's explained above, canonical-raft depends on the raft library developed by canonical and it works with libuv.
apt install pkg-config libuv1-dev gcc make
git submodule update --init --recursive
cargo build
Note that it is highly recommended to run this library in release mode, for performances reasons.
cargo build --release