Documentation ¶
Index ¶
Constants ¶
View Source
const DEFAULT_HASH_RING_REPLICAS = 100
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsistentHashing ¶
type ConsistentHashing struct { Nodes map[uint32]HashRingNode sync.RWMutex // contains filtered or unexported fields }
func NewConsistentHashing ¶
func NewConsistentHashing() *ConsistentHashing
func (*ConsistentHashing) AddNode ¶
func (c *ConsistentHashing) AddNode(node *HashRingNode) bool
func (*ConsistentHashing) GetNode ¶
func (c *ConsistentHashing) GetNode(key string) HashRingNode
func (*ConsistentHashing) GetNodeById ¶
func (c *ConsistentHashing) GetNodeById(id int) HashRingNode
func (*ConsistentHashing) RemoveNode ¶
func (c *ConsistentHashing) RemoveNode(node *HashRingNode)
type HashRingNode ¶
func NewHashRingNode ¶
func NewHashRingNode(id int, ip string, port int, weight int) *HashRingNode
Click to show internal directories.
Click to hide internal directories.