consistenthash

package
v0.0.0-...-b97aeb0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 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 Hash

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

Hash define a ring hash

func NewHash

func NewHash(replicas int, hashFunk HashFunc) *Hash

func (*Hash) Add

func (h *Hash) Add(key string)

func (*Hash) AddMulti

func (h *Hash) AddMulti(keys ...string)

func (*Hash) Get

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

func (*Hash) IsEmpty

func (h *Hash) IsEmpty() bool

func (*Hash) Remove

func (h *Hash) Remove(key string)

type HashFunc

type HashFunc func([]byte) uint32

HashFunc we need a function to convert []byte to uint32 to put it in ring hash

Jump to

Keyboard shortcuts

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