Documentation
¶
Index ¶
Constants ¶
View Source
const (
// TopWeight is the top weight that one entry might set.
TopWeight = 100
)
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
Hash consistently chooses a hash bucket number in the range [0, numBuckets) for the given key. numBuckets must be >= 1.
func HashString ¶
HashString works like hash but accept string as an input.
Types ¶
type ConsistentHash ¶ added in v0.1.26
type ConsistentHash struct {
// contains filtered or unexported fields
}
A ConsistentHash is a ring hash implementation. 一致性哈希
func NewCustomConsistentHash ¶ added in v0.1.26
func NewCustomConsistentHash(replicas int, fn Func) *ConsistentHash
NewCustomConsistentHash returns a ConsistentHash with given replicas and hash func. 有参构造器
Click to show internal directories.
Click to hide internal directories.