consistentHash

package
v0.0.0-...-6c569f3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 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 ConsistentHash

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

ConsistentHash contains all hashed keys

func NewConsistentHash

func NewConsistentHash(replicas int, fn Hash) *ConsistentHash

NewConsistentHash creates a Map instance hash func defaults to crc32

func (*ConsistentHash) AddNode

func (ch *ConsistentHash) AddNode(keys ...string)

AddNode adds a node into hash ring

func (*ConsistentHash) DelNode

func (ch *ConsistentHash) DelNode(keys ...string)

func (*ConsistentHash) GetNode

func (ch *ConsistentHash) GetNode(key string) string

GetNode gets a node according to the key

type Hash

type Hash func(key []byte) uint32

Hash maps bytes to uint32

Jump to

Keyboard shortcuts

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