Package Usage: go: github.com/buraksezer/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.
2 versions
Latest release: over 2 years ago
143 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/buraksezer/consistent