# level-cluster

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

Latest version **0.0.7** (published 2013-09-28) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install level-cluster
pnpm add level-cluster
yarn add level-cluster
bun add level-cluster
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2013-09-28 |
| First published | 2013-09-15 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Eugene Ware |
| Maintainers | eugeneware |
| Keywords | level, levelup, leveldb, cluster, hash, clustering, availability, high-availability, nosql, datqbase, node-hashring, hashing, consistent, multilevel |

## Links

- npm: https://www.npmjs.com/package/level-cluster
- Repository: https://github.com/eugeneware/level-cluster
- Issues: https://github.com/eugeneware/level-cluster/issues
- npm.io page: https://npm.io/package/level-cluster

## Dependencies (4)

- [clone](https://npm.io/package/clone.md) ~0.1.10
- [through](https://npm.io/package/through.md) ~2.3.4
- [hashring](https://npm.io/package/hashring.md) ~1.0.2
- [mergesort-stream](https://npm.io/package/mergesort-stream.md) 0.0.1

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 0.0.7 (latest) — 2013-09-28
- 0.0.6 — 2013-09-16
- 0.0.3 — 2013-09-15
- 0.0.2 — 2013-09-15

## README

# level-cluster

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

[![build status](https://secure.travis-ci.org/eugeneware/level-cluster.png)](http://travis-ci.org/eugeneware/level-cluster)

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

`level-cluster` tries to implement the [levelup](https://github.com/rvagg/node-levelup) API
but on top of a [multilevel](https://github.com/juliangruber/multilevel) cluster.

Currently assumes [bytewise/hex](https://github.com/deanlandolt/bytewise) as a keyEncoding.

## Installation

This module is installed via npm:

``` bash
$ npm install level-cluster
```

## Example Usage

Assuming some [multilevel](https://github.com/juliangruber/multilevel) servers listening
on `['127.0.0.1:3000', '127.0.0.1:3001', '127.0.0.1:3002']`:

``` js
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
```

---
_Source: https://npm.io/package/level-cluster · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
