The plan is to provide traits for a Transport, Machine, and Storage which can be passed to a Node instance which then manages the state of the machine over the transport on the storage.
Further crates will later provide implementations for e.g. a TCPTransport or a HashMapMachine.
The project can be found on github:
But don't expect too much yet, it's still WIP... 😉 🦀
Today I worked on a new Machine trait for my raft Node. The new trait introduces the possibility to store and read state from the machine.
This was previously only possible through the node itself and very unhandy. The machine can now be accessed on the same thread where the node was created.
I was able to do this without using any locks (Mutex, etc.). All inter-thread communication is done with channels so far.
However, the implementation is currently very slow. All operations on the machine are blocking for now and lead to the whole cluster processing only one state change per tick (100ms).
This can be changed by introducing an asynchronous API, which will be implemented later.
I added async support for the machine implementation. I am using the new async/await syntax from nightly and it looks very good so far. The rustasync/runtime executor works like a charm!
I have also added #serde support for the machine trait to support building a machine from a storage snapshot and entries. However, I am not quite happy with the type constraints on my machine. It feels like a hack and will probably cause problems in the future!
The overall performance is now a lot better. However, writes are still quite slow, although I managed to track the problem down to the raft-rs implementation.
Additionally, the raft cluster is crashing and getting very slow when doing many state-change proposals at once.
I think it is now time to look again into properly implementing the ready state processing. Currently it is quite hacky and likely the source of all my raft related problems :D
You can follow development on github: https://github.com/fin-ger/simple-raft-node
The project runs on rust-nightly only.
I continued development of my raft-node implementation in #rust and finally finished introducing TCP transports!
However, the implementation still contains some hacks and is definitely unstable.
A working TCP transport can be found under examples/tcp.rs on github:
Server run by the main developers of the project It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!