ketama: Index | Files

package ketama

import ""

Package ketama implements a consistent hashing ring.


Package Files


type ByHash Uses

type ByHash []*Node

ByHash implements sort.Interface.

func (ByHash) Len Uses

func (s ByHash) Len() int

func (ByHash) Less Uses

func (s ByHash) Less(i, j int) bool

func (ByHash) Swap Uses

func (s ByHash) Swap(i, j int)

type Node Uses

type Node struct {
    // contains filtered or unexported fields

Node is the hashing ring node.

func NewNode Uses

func NewNode(key string, data interface{}, weight uint) *Node

NewNode creates a new Node.

func (*Node) Data Uses

func (n *Node) Data() interface{}

Data returns the Node data.

func (*Node) Key Uses

func (n *Node) Key() string

Key returns the Node key.

func (*Node) Weight Uses

func (n *Node) Weight() uint

Weight returns the Node weight.

type Ring Uses

type Ring struct {
    // contains filtered or unexported fields

Ring is the ketama hashing ring.

func NewRing Uses

func NewRing(nodes []*Node) *Ring

NewRing creates a new Ring.

func (*Ring) Get Uses

func (r *Ring) Get(key string) *Node

Get node by key from ring. Returns nil if the ring is empty.

Package ketama imports 3 packages (graph). Updated 2016-07-17. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).