Documentation ¶
Overview ¶
Package distribution implements distributions such as consistent hashing compatible with twemproxy (hopefully)
This implementation draws from the Daisuke Maki's Perl module, which itself is based on the original libketama code. That code was licensed under the GPLv2, and thus so is this.
The major API change from libketama is that Algorithm::ConsistentHash::Ketama allows hashing arbitrary strings, instead of just memcached server IP addresses.
Original source: https://github.com/dgryski/go-ketama/blob/master/ketama.go
Modified to store integers directly to avoid a pointer lookup and type coercion
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KetamaContinuum ¶
type KetamaContinuum struct {
// contains filtered or unexported fields
}
func NewKetama ¶
func NewKetama(buckets []Bucket) (*KetamaContinuum, error)
func (KetamaContinuum) Get ¶
func (c KetamaContinuum) Get(h uint32) int
Retrieves the Data for a uint32 value generated by another algorithm.
type ModulaContinuum ¶
type ModulaContinuum struct {
// contains filtered or unexported fields
}
func NewModula ¶
func NewModula(buckets []Bucket) (*ModulaContinuum, error)
func (ModulaContinuum) Get ¶
func (c ModulaContinuum) Get(h uint32) int
Retrieves the array index for a uint32 value generated by another algorithm.