Consistent hash package for Go.
go get stathat.com/c/consistent
Look at the godoc.
This package was extracted from production code powering StatHat, so clearly we feel that it is production-ready, but it should still be considered experimental as other uses of it could reveal issues we aren't experiencing.
We'd love to hear from you if you are using consistent
.
Get in touch: @stathat or contact us here.
Written by Patrick Crosby at StatHat. Twitter: @stathat
Changes in jiangz222/consistent
- Support custom hash function in Config to New instance
- Support default number of replicas in Config to New instance
- Support number of replicas for every single member(both in Add and Remove)
x := New(newConfig())
x.Add("def", 40)
x.Remove("def")
- Add function: SetWithReplicas(),MemberReplicas()