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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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