consistenthash

package
v0.0.0-...-ff47537 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 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 HashRing

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

HashRing represents the consistent hash ring.

func NewHashRing

func NewHashRing(replicas int) *HashRing

NewHashRing creates a new HashRing.

func (*HashRing) AddNode

func (hr *HashRing) AddNode(node string)

AddNode adds a node to the hash ring.

func (*HashRing) AddNodeVirtualNode

func (hr *HashRing) AddNodeVirtualNode(node string, virtualNodes int)

AddNode adds a node to the hash ring with virtual nodes.

func (*HashRing) GetNode

func (hr *HashRing) GetNode(key string) string

GetNode returns the node to which the key is mapped.

func (*HashRing) RemoveNode

func (hr *HashRing) RemoveNode(node string)

RemoveNode removes a node from the hash ring.

Jump to

Keyboard shortcuts

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