Giter VIP home page Giter VIP logo

chord's Introduction

Chord Summary

Chord is lookup and maintenance protocol for storing key-value pairs in a distributed hash table (DHT). The chord protocol specifies how to join new peers to an existing network, how to map hashed-keys onto peers, how to recover from peer departures and failures, and how to replicate data over the network. As a result, the chord protocol defines an abstract storage medium that is decentralized, load balanced, fault tolerant, and available.

Project Details

This JavaScript implementation of the chord protocol is designed to run on Node.js, and inspired from many academic papers written on the topic of chord. The chord protocol does not define how key-value pairs are to be stored and accessed within the DHT as this is trivial with a data store of choice and the specified lookup procedure. Thus, this project is split into two main class files (i.e. ./lib/chord.js and ./lib/bucket.js). The chord class exposes an API for creating peers and looking up keys, while the bucket class exposes an API for actually getting, setting, and deleting values withing the DHT. This implementation also makes heavy use of async/await (so Node version >=7.6 is required) and generator functions; it also relies on gRPC protocol buffers to simplify peer message-passing during maintenance procedures which differs from the traditional RPC over UDP used in the chord specification. Demo applications using the class files may be found in the ./examples directory, which includes a tool for interfacing with a chord peer or network, and a simple peer-to-peer chat tool. Further development of this project may use of public keys as node identifiers, encrypted message-passing, a UDP transport layer, and a full rewrite in some compiled language.

Installation

git clone https://github.com/danrpts/chord.git
cd ./chord
npm install

Using examples

To spin up a peer on a random port: npm run cli -- -p 0

Now to view CLI commands: help

or

To spin up a peer, join a network, and set your nickname: npm run chat -- --join=<host> --nick=<name>

Now to send a hello world message to another user: /tell <name> hello world!

Chord API

ping(host)

state(host)

join(host)

lookup(key)

Bucket API

get(key)

has(key)

set(key, value)

del(key)

dump(host)

chord's People

Contributors

danrpts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chord's Issues

good job

This is a good job( I think), but it look like too weight. So, I may write another one for work.
Come on manπŸ˜‰πŸ˜‰οΌŒ and I will look forward to your work

The -r option

Hello, I was wondering what the -r command line option actually does?
I cant see what extra functionality it provides ?

Thank you very much,

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.