hash

package
v0.0.0-...-d82f707 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crc32Hash

func Crc32Hash(key string) uint32

func SimpleHash

func SimpleHash(key string) uint32

基础hash功能

func SimpleHashExp

func SimpleHashExp(key string, sed uint32) uint32

基础hash 选择节点实现

Types

type DistributedMap

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

func New

func New(replicas int, hashFun Hash) *DistributedMap

func (*DistributedMap) AddNodes

func (d *DistributedMap) AddNodes(nodes ...string)

添加节点s

func (*DistributedMap) GetNodeAddr

func (d *DistributedMap) GetNodeAddr(key string) (string, error)

获取当前key在那台节点上

type Hash

type Hash func(key string) uint32

Jump to

Keyboard shortcuts

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