consistenthash

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: GPL-3.0 Imports: 4 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 func(data []byte) uint32

type Map

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

func New

func New(replicas int, hash Hash) *Map

New 构造函数 允许自定义hash函数和节点倍数

func (*Map) Add

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

Add 增加节点

func (*Map) Get

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

Get 获取对应节点

func (*Map) Remove

func (m *Map) Remove(key string)

Remove 移除节点

Jump to

Keyboard shortcuts

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