- Complete features including
AppendEntires
,RequestVote
,InstallSnapshot
andPreVote
- Design focuses on understanding
- Asynchronous lock-free implementation using EventLoop
- Multi-Raft is supported
-
Nodes communicate with RPC
RaftService
. So we provide an Event-Based async RPC Framework based on Netty and Kyro inio.lubricant.consensus.raft.transport
. -
Basic operation
Leader Election
,Log Replication
andSnapshot Synchronization
are included inio.lubricant.consensus.raft.context
. Besides, we defineRaftContext
concept to isolate irrelevant state machine and provide better concurrency. -
For reliable log persistence, we provide
RaftLog
which storage its entries in RocksDB. -
RSM
model could adapt to various application by change itsSateMachine
. So we provideRaftMachine
interface, and developer could crate unique Raft application by customizing their ownRaftMachine
. -
PreVote
andInstallSnapshot
are optional for developers and could be disabled
To show the function of this lib, we simply implement a RaftMachine which only append the data on a file.
Run these 3 main class TestNode1~3
to setup a cluster then try to stop and restart these processes.
If system is functional, all 3 files should be consistent.