consistenthash

package
v0.0.0-...-b51443a Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: BSD-2-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 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) Add

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

Add 方法用来添加缓存节点,参数为节点key,比如使用IP

func (*Map) Get

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

Get 方法根据给定的对象获取最靠近它的那个节点key

func (*Map) IsEmpty

func (m *Map) IsEmpty() bool

type UInt32Slice

type UInt32Slice []uint32

func (UInt32Slice) Len

func (s UInt32Slice) Len() int

func (UInt32Slice) Less

func (s UInt32Slice) Less(i, j int) bool

func (UInt32Slice) Swap

func (s UInt32Slice) Swap(i, j int)

Jump to

Keyboard shortcuts

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