class ConsistentHash[T] extends AnyRef

Consistent Hashing node ring implementation.

A good explanation of Consistent Hashing: https://tom-e-white.com/2007/11/consistent-hashing.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
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ConsistentHash
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. 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.

  2. 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.

  3. 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.

  4. def isEmpty: Boolean

    Is the node ring empty, i.e.

    Is the node ring empty, i.e. no nodes added or all removed.

  5. 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

  6. 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

  7. 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.

  8. val virtualNodesFactor: Int