consistent

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNodes

func AddNodes(nodes ...*HashNode) error

AddNodes 添加节点。

func DeleteNodes

func DeleteNodes(node *HashNode) error

DeleteNodes 删除节点。

func ExistNode

func ExistNode(node *HashNode) bool

ExistNode 是否存在这个节点

func GetNodeCount added in v1.3.1

func GetNodeCount() int

节点数量

func GetVirtualNodeCount added in v1.3.1

func GetVirtualNodeCount() int

拟节点数量

func Init

func Init(virtualNodesNums int, hashFunc ...HashFunc)

Init virtualNodesNums 虚拟节点个数,默认250个 hashFunc hash方法,默认SHA1BasedHash cman里使用这个默认的方法

func OptimizedHash added in v1.3.1

func OptimizedHash(data []byte) uint32

Types

type HashFunc

type HashFunc func([]byte) uint32

type HashNode

type HashNode struct {
	*xctrl.Node
	Port int `json:"port"`
}

func Get

func Get(key string) (*HashNode, error)

type NodesSlice

type NodesSlice []uint32

NodesSlice 为了快速查找

func (NodesSlice) Len

func (s NodesSlice) Len() int

func (NodesSlice) Less

func (s NodesSlice) Less(i, j int) bool

func (NodesSlice) Swap

func (s NodesSlice) Swap(i, j int)

type SipProfile

type SipProfile struct {
	Name string `json:"name"`
	Port int    `json:"port"`
}

Jump to

Keyboard shortcuts

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