consistenthash

package
v1.130.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: Apache-2.0 Imports: 1 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 See the following docs: - https://www.eecs.umich.edu/techreports/cse/96/CSE-TR-316-96.pdf - https://github.com/dgryski/go-rendezvous - https://dgryski.medium.com/consistent-hashing-algorithmic-tradeoffs-ef6b8e2fcae8

func NewConsistentHash

func NewConsistentHash(nodes []string, hashSeed uint64) *ConsistentHash

NewConsistentHash creates a consistent hash based on the nodes.

func (*ConsistentHash) GetNodeIdx

func (rh *ConsistentHash) GetNodeIdx(h uint64, excludeIdxs []int) int

GetNodeIdx returns the node index that the input hash value should belong to.

Jump to

Keyboard shortcuts

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