Giter VIP home page Giter VIP logo

naive-go-raft's Introduction

naive-go-raft

Super simplified naive Golang implementation of Raft cluster concensus algorithm(https://raft.github.io/) in a simulator environment: a super simplified cluster with a handler that simulates the network.

How to use?

  • Build the module using go build.
  • Curl the end-points listed in server.go to send requests to the simulator at localhost:8080.

End-points:

  • startHandler: Start the simulator, with size parameter being the size of the cluster.
    • curl http://localhost:8080/startHandler?size=10
  • listNodes: Get the status of all the nodes in the cluster.
  • stopLeader: Stop the leader node.
  • stopHandler: Stop the simulator.
  • getCommits: Get the commit record of a single node, with id:int parameter begin the id of the node.
    • curl http://localhost:8080/getCommits?id=1
  • getEvents: Get the event record of a single node, with id:int parameter begin the id of the node.
    • curl http://localhost:8080/getEvents?id=2
  • stopNode: Stop a specific node, with id:int parameter begin the id of the node.
  • startNode: Start a specific node, with id:int parameter begin the id of the node.
  • addPart: Add a new partition
  • removePart: Remove a partition
  • clientSend: Simulates request sending from client, will be handled by the leader node, with msg:string being the content of the request.
    • curl http://localhost:8080/clientSend?msg=hello

Bugs

  • Recovery from partition removal. New client message won't be sent.
  • Unstable for the first few seconds. (Become stable when the std output keeps looping heartbeat notifications for at least 3 seconds)

Todo:

  • Parition merging
  • Code style fixing.
  • Timeout fixing.

naive-go-raft's People

Contributors

llxxll12345 avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

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.