consistenthashing

package
v0.0.0-...-36750ee Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsistentHashing

type ConsistentHashing struct {
	Nodes       map[uint32]Node
	SortedNodes []uint32
}

func NewConsistentHashing

func NewConsistentHashing() *ConsistentHashing

func (*ConsistentHashing) AddNode

func (c *ConsistentHashing) AddNode(node Node)

func (*ConsistentHashing) GetNode

func (c *ConsistentHashing) GetNode(key string) Node

func (*ConsistentHashing) RebalanceNodes

func (c *ConsistentHashing) RebalanceNodes()

func (*ConsistentHashing) RemoveNode

func (c *ConsistentHashing) RemoveNode(node Node)

type IConsistentHashing

type IConsistentHashing interface {
	AddNode(node Node)
	RemoveNode(node Node)
	RebalanceNodes()
	GetNode(key string) Node
}

type Node

type Node struct {
	IP   string
	Name string
	Keys []string
}

Jump to

Keyboard shortcuts

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