Interface IConsistentHashRing<TNode>
Represents a consistent hash ring.
Inherited Members
System.Collections.Generic.IEnumerable<System.ValueTuple<TNode, System.UInt32>>.GetEnumerator()
System.Collections.IEnumerable.GetEnumerator()
Namespace: ConsistentHashing
Assembly: ConsistentHashing.dll
Syntax
public interface IConsistentHashRing<TNode> : IEnumerable<(TNode, uint)>, IEnumerable where TNode : IComparable<TNode>
Type Parameters
Name | Description |
---|---|
TNode | The type of node to store in the ring. |
Properties
| Improve this Doc View SourceIsEmpty
Gets whether the consistent hash ring is empty or not.
Declaration
bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the ring is empty and false otherwise. |
Partitions
Gets all partitions where a partition is a hash range and the owner node.
Declaration
IEnumerable<Partition<TNode>> Partitions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Partition<TNode>> | An enumeration of all the partitions defined by the hash ring. |
Methods
| Improve this Doc View SourceAddNode(TNode, UInt32)
Adds the specified node to the hash ring at the specified point.
Declaration
void AddNode(TNode node, uint point)
Parameters
Type | Name | Description |
---|---|---|
TNode | node | The node to add. |
System.UInt32 | point | The point at which to add the node to. |
GetNode(UInt32)
Gets the node that owns the hash.
Declaration
TNode GetNode(uint hash)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | hash | The hash. |
Returns
Type | Description |
---|---|
TNode | The node that owns the hash. |
RemoveNode(TNode)
Removes all instances of the node from the hash ring.
Declaration
void RemoveNode(TNode node)
Parameters
Type | Name | Description |
---|---|---|
TNode | node | The node to remove. |