ketama

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket interface {
	Label() string
	Weight() uint32
}

Bucket is a source we hash into. The Label() is used as the hash key and Weight represents how much we weight this bucket against others

type Continuum

type Continuum struct {
	// contains filtered or unexported fields
}

Continuum stores the ketama hashring and allows users to hash bytes into the ring

func New

func New(buckets []Bucket) *Continuum

New creates a new Continuum that uses the passed Buckets as parts of the ring

func (*Continuum) Bucket

func (c *Continuum) Bucket(ringLocation uint32) Bucket

Bucket returns the bucket at or after a location in the ring

func (*Continuum) Buckets

func (c *Continuum) Buckets() []Bucket

Buckets returns the buckets last set in the continuum

func (*Continuum) Hash

func (c *Continuum) Hash(thing []byte) Bucket

Hash an array of bytes into a location in the ring

func (*Continuum) Reset

func (c *Continuum) Reset(buckets []Bucket)

Reset the Continuum to use the given buckets in the hashring

Jump to

Keyboard shortcuts

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