npm install hash-ringhash-ring
=========

Hash ring implemented in JavaScript. Inspired by http://www.tom-e-white.com//2007/11/consistent-hashing.html
- - -
```
npm install hash-ring
Initialize hash ring instance.
+ nodes {Array}: Nodes
+ options {Object}: Config
+ hashMethod {String}: Specific hash method, crc32 or md5, default is crc32128
+ replicas {Int}: Virtual nodes number,. default is
``
const HashRing = require('HashRing');
let ring = new HashRing([
'1',
'2'
], {
hashMethod: 'crc32',
replicas: 1
});
Add a node to hash ring, node should a string.
+ node {String}: Node
``
const node = '3';
ring.addNode(node);
Remove a node from hash ring, node should a string
+ node {String}: Node
``
const node = '1';
ring.removeNode(node);
getNode
Get a node by specific key.
+ key {String}: Query key
``
const key = '5';
console.log(ring.getNode(key));
```
make test