Documentation
¶
Index ¶
- type HashKey
- type HashKeyOrder
- type HashRing
- func (h *HashRing) AddNode(node string) *HashRing
- func (h *HashRing) AddWeightedNode(node string, weight int) *HashRing
- func (h *HashRing) GenKey(key string) HashKey
- func (h *HashRing) GetNode(stringKey string) (node string, ok bool)
- func (h *HashRing) GetNodePos(stringKey string) (pos int, ok bool)
- func (h *HashRing) GetNodes(stringKey string, size int) (nodes []string, ok bool)
- func (h *HashRing) RemoveNode(node string) *HashRing
- func (h *HashRing) Size() int
- func (h *HashRing) UpdateWeightedNode(node string, weight int) *HashRing
- func (h *HashRing) UpdateWithWeights(weights map[string]int)
- type HashRingCluster
- type ServerInfo
- type VirtualNodeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashKeyOrder ¶
type HashKeyOrder []HashKey
func (HashKeyOrder) Len ¶
func (h HashKeyOrder) Len() int
func (HashKeyOrder) Less ¶
func (h HashKeyOrder) Less(i, j int) bool
func (HashKeyOrder) Swap ¶
func (h HashKeyOrder) Swap(i, j int)
type HashRing ¶
type HashRing struct {
// contains filtered or unexported fields
}
func NewWithWeights ¶
func (*HashRing) AddWeightedNode ¶
func (*HashRing) RemoveNode ¶
func (*HashRing) UpdateWeightedNode ¶
func (*HashRing) UpdateWithWeights ¶
type HashRingCluster ¶
type HashRingCluster struct {
// contains filtered or unexported fields
}
func NewHashRingCluster ¶
func NewHashRingCluster(numberOfVirtualNodes int) *HashRingCluster
func (*HashRingCluster) AddServer ¶
func (hc *HashRingCluster) AddServer(name string, rangeString string) error
AddServer
rangeString: a-b where a and b are integers >= 0
func (*HashRingCluster) GetServer ¶
func (hc *HashRingCluster) GetServer(key string) string
func (*HashRingCluster) GetServerInfo ¶
func (hc *HashRingCluster) GetServerInfo(serverName string) *ServerInfo
type ServerInfo ¶
type ServerInfo struct {
// contains filtered or unexported fields
}
type VirtualNodeInfo ¶
type VirtualNodeInfo struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.