Documentation
¶
Overview ¶
Package consistenthash is a Go port of the Graphite project's consistent-hashing algorithm. Givn the same settings (e.g. vnodes), consistenthash will yield the same node by name for a given key as you'd observe in carbon-relay.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashRing ¶
HashRing implmenents a consistent-hash ring with a configurable number of vnodes that are mapped to a list of real nodes.
func (*HashRing) AddNode ¶
AddNode takes a node keyname and name. The name will populate the node.nodeName field, but we pass an explicit keyname value so that the hashing function is using the same naming convention as the consistent hashing implementation in Graphite. The Graphite project hashes nodes using the following format: "('127.0.0.1', 'a'):0".
func (*HashRing) RemoveNode ¶
RemoveNode drops a node from the hash ring.