import "github.com/andy2046/gopie/pkg/jumphash"
Package jumphash provides a jump consistent hash implementation.
func Hash(key uint64, buckets int) int
Hash takes a key and the number of buckets, returns an integer in the range [0, buckets). If the number of buckets is not greater than 1 then 1 is used.
func HashString(key string, buckets int) int
HashString takes string as key instead of integer and uses CRC-64 to generate key.
type Hasher struct {
// contains filtered or unexported fields
}
Hasher represents a jump consistent Hasher using a string as key.
func New(n int) *Hasher
New returns a new instance of of Hasher.
func (h *Hasher) Hash(key string) int
Hash returns the integer hash for the given key.
func (h *Hasher) N() int
N returns the number of buckets the hasher can assign to.
Generated by godoc2md