View on GitHub

libraft

Raft Distributed Consensus Protocol in Java

Download this project as a .zip file Download this project as a tar.gz file

Overview

libraft is a Java library that implements the Raft distributed consensus protocol. It aims to be a correct, modular and understandable Raft implementation.

Features

libraft provides:

And consists of 2 components:

  1. libraft-core
  2. libraft-agent

libraft-core

Contains an implementation of the Raft algorithm. It also defines interfaces for the components (such as timers, packet senders, storage, etc.) it needs to operate. These interfaces make very few assumptions and should be easy to implement using any number of technologies.

An architecture diagram is shown below. Interfaces are in italics and implementations in bold.

libraft-core Architecture Diagram

libraft-agent

Typically the component most applications will interact with. It provides a:

  1. Reference implementation for the interfaces defined in libraft-core.
  2. Facade over libraft-core that can be instantiated to provide distributed consensus.

The relationship between the libraft-* components is shown below. Again, interfaces are in italics and implementations in bold.

libraft-agent Architecture Diagram

Samples

libraft also comes with a fully-implemented sample application in libraft-samples/kayvee. KayVee is a distributed key-value store that uses libraft-agent to replicate key-value pairs to a cluster. It demonstrates how to integrate libraft into a server to provide distributed consensus.

The relationship between KayVee servers, clients and libraft-agent is shown below.

KayVee Cluster Diagram

Getting libraft

libraft is available through Maven Central: add libraft-agent as a dependency.

Gradle

dependencies {
    compile 'io.libraft:libraft-agent:0.1.1'
}

Maven

<dependencies>
    <dependency>
        <groupId>io.libraft</groupId>
        <artifactId>libraft-agent</artifactId>
        <version>0.1.1</version>
    </dependency>
</dependencies>

Documentation

In addition to the project README, libraft comes with javadoc:

Component Latest Version
libraft-core 0.1.1
libraft-agent 0.1.1
kayvee 0.1.1

Getting in Touch

Please submit all code or documentation issues or feedback to Github Issues.

If you have other libraft or Raft questions, please post to the raft-dev mailing list.