Giter VIP home page Giter VIP logo

simpleraft's Introduction

simpleRaft

Build Status

What?

A implementation of Raft in pure Python.

Why?

After reading a few papers on the Raft algorithm I figured I would implement it and use it for projects of mine that require the consistency that Raft provides to ensure their correctness.

Details

This implementation tries to stay as pure Python as possible to ensure that as few dependencies are required to run this outside of the code in this repo. I am also striving to have it run on Python 2.6+ as well to make it as flexible as possible.

The system is designed in two parts. There are a system of state classes that define the functionality required for the specific states that a node can go through during the running of Raft, these include:

  • Follower
  • Candidate
  • Leader

Each one has their roles defined in their class files. Along with these state classes there are defined messages that will be used to keep the message format well defined and abstracted from the wire format as much as possible.

The final part is the communication layer. The current communication layer will use Gossiping using randomized subgroups at the moment, but it will be written in such a way so as to be easy to implement and plug in a different communicationl layer at a later time.

References:

simpleraft's People

Contributors

kainswor avatar seocam avatar streed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simpleraft's Issues

Is this completed?

Hello,

I have a few questions.

I was wondering if this the raft algorithm was fully implemented in this?

Do you have any reference implementations for this?

I am supposed to download a raft implementation for my Distributed Systems class and add some more functionality. I'm trying to find a working implementation in python and this looks fairly good.

Usage example, state transitions

Please provide a usage example. Also, I can't see any state transition. Do I have to create all states and handle transitions manually?

Check for log term int on_vote_request

Raft uses the voting process to prevent a candidate from winning an election unless its log contains all committed entries. A candidate must contact a majority of the cluster in order to be elected, which means that every committed entry must be present in at least one of those servers. If the candidate’s log is at least as up-to-date as any other log in that majority (where “up-to-date” is defined precisely below), then it will hold all the committed entries. The RequestVote RPC implements this restriction: the RPC includes information about the candidate’s log, and the voter denies its vote if its own log is more up-to-date than that of the candidate.
Raft determines which of two logs is more up-to-date by comparing the index and term of the last entries in the logs. If the logs have last entries with different terms, then the log with the later term is more up-to-date. If the logs end with the same term, then whichever log is longer is more up-to-date.

I don't see any check for term in on_vote_request. May be I watch in a wrong place?

test_candidate_server_wins_election

in the test_candidateServer.py, func: test_candidate_server_wins_election, when i increased the server._total_nodes to 4, it went wrong, "state, response = self._state.on_message(message)"showed that "TypeError: NoneType object is not iterable"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.