All Projects → vedhavyas → hashring

vedhavyas / hashring

Licence: Unlicense license
Consistent-hashing: Hash ring implementation in Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to hashring

hashring
Consistent hashing hashring implementation.
Stars: ✭ 28 (-6.67%)
Mutual labels:  consistent-hashing, hashring
rust-hash-ring
A consistent hashing library in Rust
Stars: ✭ 30 (+0%)
Mutual labels:  consistent-hashing, consistent-hashing-library
lua-resty-jump-consistent-hash
consistent hash for openresty
Stars: ✭ 24 (-20%)
Mutual labels:  consistent-hashing
consistent-hashing
an implementation of Consistent Hashing in pure Ruby using an AVL tree
Stars: ✭ 40 (+33.33%)
Mutual labels:  consistent-hashing
dynamic-sharding
用动态分片解决pushgateway高可用 单点 HA问题
Stars: ✭ 27 (-10%)
Mutual labels:  consistent-hashing
distributed-dev-learning
汇总、整理常用的分布式开发技术,给出demo,方便学习。包括数据分片、共识算法、一致性hash、分布式事务、非侵入的分布式链路追踪实现原理等内容。
Stars: ✭ 39 (+30%)
Mutual labels:  consistent-hashing
Doramon
个人工具汇总:一致性哈希工具,Bitmap工具,布隆过滤器参数生成器,Yaml和properties互转工具,一键式生成整个前后端工具,单机高性能幂等工具,zookeeper客户端工具,分布式全局id生成器,时间转换工具,Http封装工具
Stars: ✭ 53 (+76.67%)
Mutual labels:  consistent-hashing

Consistent Hashing

Consistent hashing is a special kind of hashing such that when a hash table is resized, only K/n keys need to be remapped on average, where K is the number of keys, and n is the number of slots. This academic paper from 1997 introduced the term "consistent hashing" as a way of distributing requests among a changing population of Web servers. Each slot is then represented by a node in a distributed system. The addition (joins) and removal (leaves/failures) of nodes only requires K/n items to be re-shuffled when the number of slots/nodes change

Usage

import "github.com/vedhavyas/hashring"

type HashRing

type HashRing struct {
}

HashRing to hold the nodes and indexes

func New

func New(replicaCount int, hash hash.Hash32) *HashRing

New returns a Hash ring with provided virtual node count and hash If hash is nil, fvn32a is used instead

func (*HashRing) Add

func (hr *HashRing) Add(node string) error

Add adds a node to Hash ring

func (*HashRing) Delete

func (hr *HashRing) Delete(node string) error

Delete deletes the nodes from hash ring

func (*HashRing) Locate

func (hr *HashRing) Get(key string) (node string, err error)

Locate returns the node for a given key

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].