Jump Consistent Hashing
This is a Golang implementation of a A Fast, Minimal Memory, Consistent Hash Algorithm called The Jump Consistent Algorithm.
Ref: https://arxiv.org/pdf/1406.2294.pdf
Using the package
go get github.com/MadhavJivrajani/go-jump-consistent-hash
Example:
package main
import (
"fmt"
jch "github.com/MadhavJivrajani/go-jump-consistent-hash"
)
func main() {
stream := []unit64{132415, 134131, 223, 6, 1, 76, 446, 8888}
var numBuckets int32 = 7
for _, ele := range stream {
err := process(jch.Hash(ele, numBuckets))
if err != nil {
panic(err)
}
}
}
func process(bucket int64) error {
fmt.Println("Bucket:", bucket)
return nil
}
Contributing
Please feel free to raise an issue if you find something that can be implemented in a better way or if something is just wrong.
TODO