Skip to content
forked from curioloop/rafting

Asynchronous lock-free Multi-Raft library

Notifications You must be signed in to change notification settings

sy99520/rafting

This branch is up to date with curioloop/rafting:master.

Folders and files

NameName
Last commit message
Last commit date
Jan 21, 2020
Aug 8, 2020
Jan 5, 2020
Aug 8, 2020
Oct 13, 2020

Repository files navigation

rafting

Raft library implemented in Java, easy to understand

  • Complete features including AppendEntires, RequestVote, InstallSnapshot and PreVote
  • Design focuses on understanding
  • Asynchronous lock-free implementation using EventLoop
  • Multi-Raft is supported

Architecture

Communication Status

According to the paper:

  • Nodes communicate with RPC RaftService. So we provide an Event-Based async RPC Framework based on Netty and Kyro in io.lubricant.consensus.raft.transport.

  • Basic operation Leader Election, Log Replication and Snapshot Synchronization are included in io.lubricant.consensus.raft.context. Besides, we define RaftContext 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 its SateMachine. So we provide RaftMachine interface, and developer could crate unique Raft application by customizing their own RaftMachine.

  • PreVote and InstallSnapshot are optional for developers and could be disabled

Correctness verification

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.

About

Asynchronous lock-free Multi-Raft library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%