class ConsistentHash[T] extends AnyRef
Consistent Hashing node ring implementation.
A good explanation of Consistent Hashing: http://weblogs.java.net/blog/tomwhite/archive/2007/11/consistent_hash.html
Note that toString of the ring nodes are used for the node hash, i.e. make sure it is different for different nodes.
- Source
- ConsistentHash.scala
- Alphabetic
- By Inheritance
- ConsistentHash
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Value Members
-
def
:+(node: T): ConsistentHash[T]
Adds a node to the node ring.
Adds a node to the node ring. Note that the instance is immutable and this operation returns a new instance.
-
def
:-(node: T): ConsistentHash[T]
Removes a node from the node ring.
Removes a node from the node ring. Note that the instance is immutable and this operation returns a new instance.
-
def
add(node: T): ConsistentHash[T]
Java API: Adds a node to the node ring.
Java API: Adds a node to the node ring. Note that the instance is immutable and this operation returns a new instance.
-
def
isEmpty: Boolean
Is the node ring empty, i.e.
Is the node ring empty, i.e. no nodes added or all removed.
-
def
nodeFor(key: String): T
Get the node responsible for the data key.
Get the node responsible for the data key. Can only be used if nodes exists in the node ring, otherwise throws
IllegalStateException
-
def
nodeFor(key: Array[Byte]): T
Get the node responsible for the data key.
Get the node responsible for the data key. Can only be used if nodes exists in the node ring, otherwise throws
IllegalStateException
-
def
remove(node: T): ConsistentHash[T]
Java API: Removes a node from the node ring.
Java API: Removes a node from the node ring. Note that the instance is immutable and this operation returns a new instance.
- val virtualNodesFactor: Int