consistenthash

package
v0.0.0-...-ae13d62 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultReplicas = 50

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash func(data []byte) uint32

The hash function is used to generate the hash value

type Map

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

Hash table

func NewDefaultHashRing

func NewDefaultHashRing() (*Map, error)

func NewHashRing

func NewHashRing(replicas int, hash Hash) (*Map, error)

func (*Map) Get

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

get real node

func (*Map) Set

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

add node

Jump to

Keyboard shortcuts

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