Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsistentHash ¶
type ConsistentHash struct {
// contains filtered or unexported fields
}
ConsistentHash is a ring hash implementation.
func NewConsistentHash ¶
func NewConsistentHash() *ConsistentHash
NewConsistentHash returns a ConsistentHash.
func NewCustomConsistentHash ¶
func NewCustomConsistentHash(replicas int, fn Func) *ConsistentHash
NewCustomConsistentHash returns a ConsistentHash with given replicas and hash func.
func (*ConsistentHash) Add ¶
func (h *ConsistentHash) Add(keys ...string) *ConsistentHash
func (*ConsistentHash) Get ¶
func (h *ConsistentHash) Get(key string) string
Get the closest item in the hash to the provided key.
func (*ConsistentHash) IsEmpty ¶
func (h *ConsistentHash) IsEmpty() bool
IsEmpty Returns true if there are no items available.
Click to show internal directories.
Click to hide internal directories.