consistenthash

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashFunc

type HashFunc func(data []byte) uint32

func (HashFunc) Hash

func (hf HashFunc) Hash(data []byte) uint32

type Hasher

type Hasher interface {
	Hash(data []byte) uint32
}

type Map

type Map struct {
	Hasher Hasher
	// contains filtered or unexported fields
}

func New

func New(k int, h Hasher) *Map

func (*Map) Add

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

Add adds some keys to the hash.

func (*Map) Get

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

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

func (*Map) IsEmpty

func (m *Map) IsEmpty() bool

Returns true if there are no items available.

func (*Map) ReadFrom

func (m *Map) ReadFrom(r io.Reader) (n int64, err error)

func (Map) WriteTo

func (m Map) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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