redis: Index | Files

package consistenthash

import ""

Package consistenthash provides an implementation of a ring hash.


Package Files


type Hash Uses

type Hash func(data []byte) uint32

type Map Uses

type Map struct {
    // contains filtered or unexported fields

func New Uses

func New(replicas int, fn Hash) *Map

func (*Map) Add Uses

func (m *Map) Add(keys ...string)

Adds some keys to the hash.

func (*Map) Get Uses

func (m *Map) Get(key string) string

Gets the closest item in the hash to the provided key.

func (*Map) IsEmpty Uses

func (m *Map) IsEmpty() bool

Returns true if there are no items available.

Package consistenthash imports 3 packages (graph) and is imported by 10 packages. Updated 2019-04-26. Refresh now. Tools for package owners.