Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Use consistent-hashing with hash-rings to distribute reads and writes across multiple multilevel nodes.
JavaScript
branch: master
Failed to load latest commit information.
data Initial commit
test delete test
.gitignore Initial commit
.jshintrc Initial commit
.travis.yml Initial commit
Gruntfile.js Initial commit
LICENSE Initial commit
README.md fix readme with require
index.js use hostname
package.json use hostname

README.md

level-cluster

Use consistent-hashing with hash-rings to distribute reads and writes across multiple multilevel nodes.

build status

NB: Work in progress. Not currently suitable for production.

level-cluster tries to implement the levelup API but on top of a multilevel cluster.

Currently assumes bytewise/hex as a keyEncoding.

Installation

This module is installed via npm:

$ npm install level-cluster

Example Usage

Assuming some multilevel servers listening on ['127.0.0.1:3000', '127.0.0.1:3001', '127.0.0.1:3002']:

var servers = ['127.0.0.1:3000', '127.0.0.1:3001', '127.0.0.1:3002'];
var LevelCluster = require('level-cluster');
var db = new LevelCluster(servers);

 // will consistently hash the write to a server based on the key
db.put(...);

// will consistently hash all the writes and deletes to the right servers
db.batch(...);

// will retrieve the right data from the right server
db.get(...);

// will delete the right data from the right server
db.del(...);

db.createReadStream();
// will stream the data from the different servers and create a unified stream
// AND make sure it's sorted

generatorStream().pipe(db.createWriteStream());
// will distribute writes and deletes across the cluster based on the hashes of
// keys
Something went wrong with that request. Please try again.