consistent

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 7 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 Init

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

Init virtualNodesNums 虚拟节点个数,default 100个 hashFunc hash方法,默认crc32.ChecksumIEEE

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