ExHashRing.Node (ex_hash_ring v7.0.0)
View SourceTypes and Functions for working with Ring Nodes and their Replicas
Summary
Types
Nodes can be defined by either using a bare name or using a fully specified node. When using a
bare name the definition will have to be converted into a fully specified node, see
normalize/2
.
Nodes are uniquely identified in the ring by their name.
Replicas is a count of how many times a Node should be placed into a Ring.
Nodes are properly specified as a tuple of their name and their number of replicas
Nodes are expanded into multiple virtual nodes.
Functions
Expands a list of nodes into a list of virtual nodes.
Converts definitions into fully specified nodes.
Types
Nodes can be defined by either using a bare name or using a fully specified node. When using a
bare name the definition will have to be converted into a fully specified node, see
normalize/2
.
@type name() :: binary()
Nodes are uniquely identified in the ring by their name.
@type replicas() :: non_neg_integer()
Replicas is a count of how many times a Node should be placed into a Ring.
Negative replica counts will result in an ArgumentError when expanded
Nodes are properly specified as a tuple of their name and their number of replicas
@type virtual() :: {ExHashRing.Hash.t(), name()}
Nodes are expanded into multiple virtual nodes.
Functions
Expands a list of nodes into a list of virtual nodes.
@spec normalize([definition()], replicas()) :: [t()]
@spec normalize(t(), replicas()) :: t()
@spec normalize(name(), replicas()) :: t()
Converts definitions into fully specified nodes.
A single definition or a list of defintions can be normalized by this function.