Giter Site home page Giter Site logo

rafths's Introduction

rafths

rafths is a purely functional implementation of the Raft consensus algorithm in Haskell. It uses Raft to maintain a fault tolerant distributed key-value store across a cluster of replicas.

Each server exposes an HTTP API to allow inserts and lookups on the key-value store, but only the leader of the cluster may accept writes. Requests made to a server in the follower or candidate state will be automatically redirected to the current leader.

Build

Generate Thrift RPC stubs/types and compile.

thrift -r --gen hs rafths.thrift
stack build

Usage

For each server, specify the API port, the RPC port, and a config file defining all servers in the cluster.

stack exec -- rafths-exe 4041 8081 cluster.yaml
stack exec -- rafths-exe 4042 8082 cluster.yaml
stack exec -- rafths-exe 4043 8083 cluster.yaml

where cluster.yaml is

nodes:
  - host: "localhost"
    apiPort: 4041
    rpcPort: 8081
  - host: "localhost"
    apiPort: 4042
    rpcPort: 8082
  - host: "localhost"
    apiPort: 4043
    rpcPort: 8083

Lookup (GET):

curl http://localhost:4041/{key}

Insert (POST):

curl --data "value={value}" http://localhost:4041/{key}

rafths's People

Contributors

itspriyesh avatar

Watchers

 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.