hash

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsistentHashRing

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

func New

func New(replicas int, fn Hash) *ConsistentHashRing

func (*ConsistentHashRing) Add

func (h *ConsistentHashRing) Add(nodes ...string)

Add adds some keys to the hash.

func (*ConsistentHashRing) Get

func (h *ConsistentHashRing) Get(key string) string

Get gets the closest item in the hash to the provided key.

func (*ConsistentHashRing) IsEmpty

func (h *ConsistentHashRing) IsEmpty() bool

IsEmpty returns true if there are no items available.

type Hash

type Hash func(data []byte) uint32

Jump to

Keyboard shortcuts

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