consistenthash

package
v0.0.0-...-dcebd05 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 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 func(date []byte) uint32

Hash 映射bytes到uint32,用于散列键

type Map

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

Map 包含所有被散列的键

func New

func New(replicas int, fn Hash) *Map

New 创建一个一致性哈希

func (*Map) Add

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

Add 添加节点到一致性哈希里

func (*Map) Delete

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

Delete 从一致性哈希删除节点

func (*Map) Get

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

Get 获取第一个哈希值大于等于键的节点

Jump to

Keyboard shortcuts

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