consistent

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashRing

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

HashRing is our representation of a consistent hash ring (https://en.wikipedia.org/wiki/Consistent_hashing#Technique)

func NewHashRing

func NewHashRing(members ...Member) *HashRing

NewHashRing returns a new HashRing

func (*HashRing) Add

func (h *HashRing) Add(member Member) error

Add adds a single member to a hash ring

func (*HashRing) Get

func (h *HashRing) Get(key string, count int) (Members, error)

Get returns the count closest members to key on the hash ring

func (*HashRing) Remove

func (h *HashRing) Remove(member Member) error

Remove removes a single member from a hash ring

func (*HashRing) Set

func (h *HashRing) Set(members Members) (added Members, removed Members, err error)

Set updates the list of members on a hash ring

type Member

type Member string

Member represents a destination member or bucket on the hash ring

func (Member) String

func (m Member) String() string

type Members

type Members []Member

Jump to

Keyboard shortcuts

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