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

node-parted

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-parted

consistency hash. partition & load-balance for used in leviathan

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
9
50%
Maintainers
1
Weekly downloads
 
Created
Source

Parted

Leviathan数据分区器, 使用一致性Hash算法, 根据资源名称映射到环中的一个region, 并且这个region属于某个虚拟节点.

环节点的处理算法已经过优化.

散列运算: MurmurHash

API

Ring = require 'parted'

ring = new Ring
  nodes: ['172.16.0.10:4567', '172.16.0.11:2333', '172.16.0.16:2333'] # 节点地址
  replica: 100 # 副本集数量

# 添加节点 O(mlogn)
ring.addNode '172.16.10.4:80'

# 移除节点 O(n)
ring.removeNode '172.16.10.4:80'

# 根据键名查找节点 O(logn)
node = ring.schedule 'github::abbshr::parted'
# maybe => '172.16.0.16:2333'

FAQs

Package last updated on 11 Apr 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