proxy.golang.org : github.com/willscott/consistent
Package consistent provides a consistent hashing function with bounded loads. This implementation also adds partitioning logic on top of the original algorithm. For more information about the underlying algorithm, please take a look at https://research.googleblog.com/2017/04/consistent-hashing-with-bounded-loads.html Example Use: Now you can create a new Consistent instance. This function can take a list of the members. In the following sample, you add a new Member to the consistent hash ring. myMember is just a Go struct that implements the Member interface. You should know that modifying the consistent hash ring distributes partitions among members using the algorithm defined on Google Research Blog. Remove a member from the consistent hash ring: LocateKey hashes the key and calculates partition ID with this modulo operation: MOD(hash result, partition count) The owner of the partition is already calculated by New/Add/Remove. LocateKey just returns the member that is responsible for the key.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/willscott/consistent
License: MIT
Latest release: over 2 years ago
First release: over 2 years ago
Namespace: github.com/willscott
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 13 days ago