jch

package module
v0.0.0-...-cf05edb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2015 License: MIT Imports: 0 Imported by: 0

README

GoDoc Build Status

Package jch provides an implementation of the Jump Consistent Hash consistent hashing algorithm in Go.

Consistent hashing is designed to minimise hash changes when the number of buckets is changed, and is particularly useful for data sharding. More information on consistent hashing is available at http://en.wikipedia.org/wiki/Consistent_hashing.

Jump Consistent Hash was invented by John Lamping and Eric Veach, and is described in the paper "A Fast, Minimal Memory, Consistent Hash Algorithm" (2014) available at http://arxiv.org/abs/1406.2294v1.

import "github.com/beefsack/go-jch"

func ExampleHash() {
	hash := jch.Hash(28, 5)
	fmt.Print(hash)
	// Output: 2
}

Documentation

Overview

Package jch provides an implementation of the Jump Consistent Hash consistent hashing algorithm.

Consistent hashing is designed to minimise hash changes when the number of buckets is changed, and is particularly useful for data sharding. More information on consistent hashing is available at http://en.wikipedia.org/wiki/Consistent_hashing.

Jump Consistent Hash was invented by John Lamping and Eric Veach, and is described in the paper "A Fast, Minimal Memory, Consistent Hash Algorithm" (2014) available at http://arxiv.org/abs/1406.2294v1.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(key uint64, numBuckets int32) int32

Hash generates a Jump Consistent Hash given a key and a number of buckets.

Example
hash := Hash(28, 5)
fmt.Print(hash)
Output:

2

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL