New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

sharding

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sharding

a fast consistent hashing algorithm that implemented by native codes

latest
npmnpm
Version
0.1.8
Version published
Maintainers
1
Created
Source

Sharding

Usage

$ npm install --save sharding
var sharding = require('sharding');

var nodes = ['shard1', 'shard2', 'shard3'];
var s = new sharding.Sharding(nodes);
console.log('shard for user1 is [' + s.shard('user1') + ']');

// use sharding option

var option = {vnode_num: 500, seed: 20150503};
s = new sharding.Sharding(nodes, option);
console.log('shard for user1 is [' + s.shard('user1') + ']');

Parameters

  • default hash seed: 19861225
  • default virtual nodes number: 100
  • default hash algorithm: murmur2 64bit

** If your other service want to use the same sharding strategy, the parameters above MUST be the same **

Keywords

consistent

FAQs

Package last updated on 31 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts