Documentation
¶
Index ¶
- Variables
- type HashRing
- func (p *HashRing[NODE]) AddNode(node NODE) *HashRing[NODE]
- func (p *HashRing[NODE]) AddNodeWithWeight(node NODE, weight uint32) *HashRing[NODE]
- func (p *HashRing[NODE]) GetNode(key string) (node NODE, ok bool)
- func (p *HashRing[NODE]) IsNodeExist(node NODE) bool
- func (p *HashRing[NODE]) RemoveNode(node NODE) *HashRing[NODE]
- type VirtualNodeHashSliceOrder
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultVirtualNodeCount uint32 = 30 // 默认-虚拟节点基数
Functions ¶
This section is empty.
Types ¶
type HashRing ¶
type HashRing[NODE comparable] struct { // contains filtered or unexported fields }
HashRing 哈希环
func NewHashRing ¶
func NewHashRing[NODE comparable]() *HashRing[NODE]
func (*HashRing[NODE]) AddNodeWithWeight ¶
func (*HashRing[NODE]) IsNodeExist ¶
判断物理节点是否存在
func (*HashRing[NODE]) RemoveNode ¶
type VirtualNodeHashSliceOrder ¶
type VirtualNodeHashSliceOrder []uint32 // 虚拟节点-哈希值切片, 已排序, 便于二分查找
func (*VirtualNodeHashSliceOrder) Len ¶
func (p *VirtualNodeHashSliceOrder) Len() int
func (*VirtualNodeHashSliceOrder) Less ¶
func (p *VirtualNodeHashSliceOrder) Less(i, j int) bool
func (*VirtualNodeHashSliceOrder) Swap ¶
func (p *VirtualNodeHashSliceOrder) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.