consistent_hash

package
v0.0.0-...-b53a997 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

type Hash func(data []byte) uint32

哈希算法

type Map

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

func New

func New(replicas int, fn Hash) *Map

func (*Map) AddNode

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

增加机器节点,生成replicas个虚拟节点

func (*Map) Get

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

寻找最近的节点

Jump to

Keyboard shortcuts

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