consistenthash

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consistency

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

Consistency 维护peer与其hash值的关联

func New

func New(replicas int, fn HashFunc) *Consistency

func (*Consistency) GetPeer

func (c *Consistency) GetPeer(key string) string

GetPeer 计算key应缓存到的peer

func (*Consistency) Register

func (c *Consistency) Register(peersName ...string)

Register 将各个peer注册到哈希环上

type HashFunc

type HashFunc func(data []byte) uint32

HashFunc 定义哈希函数输入输出

Jump to

Keyboard shortcuts

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