Documentation
¶
Index ¶
- type HashRing
- func (r *HashRing) AddNode(node *Node)
- func (r *HashRing) CalcIndex(key string) uint32
- func (r *HashRing) GetNode(key string) (uint32, string)
- func (r *HashRing) GetNodeByIndex(keyIndex uint32) (uint32, string)
- func (r *HashRing) GetNodeExcludedNodeIDs(key string, NodeIDs []string) (uint32, string)
- func (r *HashRing) GetNodeUpDownNodes(NodeID string) (string, string)
- func (r *HashRing) IsOnline(ID string) bool
- func (r *HashRing) Node(ID string) *Node
- func (r *HashRing) PrintNodes()
- func (r *HashRing) RandomGetNodes(num int) []*Node
- func (r *HashRing) RemoveNode(nodeID string) bool
- func (r *HashRing) SetOffline(ID string)
- func (r *HashRing) SetOnline(ID string)
- func (r *HashRing) TraversalNRing()
- func (r *HashRing) TraversalVRing()
- type Node
- type VNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashRing ¶
type HashRing struct { VRing *rbtree.Rbtree NRing *rbtree.Rbtree Nodes *sync.Map // map(NodeID => *Node) NodeStatus map[string]bool // map(NodeID => status) NodeCount uint32 NodeOkCount uint32 NumberOfVirtual uint32 sync.Mutex }
HashRing
func (*HashRing) GetNodeByIndex ¶
GetNodeByIndex @params keyIndex
func (*HashRing) GetNodeExcludedNodeIDs ¶
GetNodeMissNodeID get node excluded given NodeIDs @params key
func (*HashRing) GetNodeUpDownNodes ¶
GetNodeUpDownNodes get upstream of downstream of node @params
func (*HashRing) PrintNodes ¶
func (r *HashRing) PrintNodes()
PrintNodes print all non-virtual nodes
func (*HashRing) RandomGetNodes ¶
func (*HashRing) SetOffline ¶
func (*HashRing) TraversalNRing ¶
func (r *HashRing) TraversalNRing()
TraversalNRing traverse non-virtual rbtree
func (*HashRing) TraversalVRing ¶
func (r *HashRing) TraversalVRing()
TraversalVRing traverse virtual rbtree
Click to show internal directories.
Click to hide internal directories.