Documentation
¶
Overview ¶
Package consistenthash provides an implementation of a ring hash.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
func New ¶
New returns a blank consistent hash ring that will return the key whose hash comes next after the hash of the input to Map.Get. Increasing the number of replicas will improve the smoothness of the hash ring and reduce the data moved when adding/removing nodes, at the cost of more memory.
func NewConsistentHash ¶
NewConsistentHash returns a blank consistent hash ring that will return the key whose hash comes next after the hash of the input to Map.Get. Increasing the number of replicas will improve the smoothness of the hash ring and reduce the data moved when adding/removing nodes. Increasing the tableExpansion will allocate more entries in the internal hash table, reducing the frequency of lg(n) binary searches during calls to the Map.Get method.