Class/Object

akka.persistence.multidc.crdt

ORSet

Related Docs: object ORSet | package crdt

Permalink

final class ORSet[A] extends OpCrdt[DeltaOp] with Serializable

Implements a 'Observed Remove Set' operation based CRDT, also called a 'OR-Set'. Elements can be added and removed any number of times. Concurrent add wins over remove.

It is not implemented as in the paper A comprehensive study of Convergent and Commutative Replicated Data Types. This is more space efficient and doesn't accumulate garbage for removed elements. It is described in the paper An optimized conflict-free replicated set The implementation is inspired by the Riak DT riak_dt_orswot.

The ORSet has a version vector that is incremented when an element is added to the set. The DC -> count pair for that increment is stored against the element as its "birth dot". Every time the element is re-added to the set, its "birth dot" is updated to that of the DC -> count version vector entry resulting from the add. When an element is removed, we simply drop it, no tombstones.

When an element exists in replica A and not replica B, is it because A added it and B has not yet seen that, or that B removed it and A has not yet seen that? In this implementation we compare the dot of the present element to the version vector in the Set it is absent from. If the element dot is not "seen" by the Set version vector, that means the other set has yet to see this add, and the item is in the merged Set. If the Set version vector dominates the dot, that means the other Set has removed this element already, and the item is not in the merged Set.

This class is immutable, i.e. "modifying" methods return a new instance.

Annotations
@SerialVersionUID()
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ORSet
  2. Serializable
  3. Serializable
  4. OpCrdt
  5. AnyRef
  6. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type D = DeltaOp

    Permalink
  2. type T = ORSet[A]

    Permalink
    Definition Classes
    ORSetOpCrdt

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(element: A): DeltaOp

    Permalink

    Adds an element to the set

  4. def -(element: A): DeltaOp

    Permalink

    Removes an element from the set.

  5. def ->[B](y: B): (ORSet[A], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from ORSet[A] to ArrowAssoc[ORSet[A]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  7. def add(element: A): DeltaOp

    Permalink

    Adds an element to the set

  8. def addAll(elems: Set[A]): DeltaOp

    Permalink

    Scala API: Add several elements to the set.

    Scala API: Add several elements to the set. elems must not be empty.

  9. def addAll(elems: Set[A]): DeltaOp

    Permalink

    Java API: Add several elements to the set.

    Java API: Add several elements to the set. elems must not be empty.

  10. def applyOperation(thatDelta: DeltaOp): ORSet[A]

    Permalink
    Definition Classes
    ORSetOpCrdt
  11. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  12. def clear(): DeltaOp

    Permalink

    Removes all elements from the set, but keeps the history.

    Removes all elements from the set, but keeps the history. This has the same result as using #remove for each element, but it is more efficient.

  13. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def contains(a: A): Boolean

    Permalink
  15. def elements: Set[A]

    Permalink

    Scala API

  16. def ensuring(cond: (ORSet[A]) ⇒ Boolean, msg: ⇒ Any): ORSet[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from ORSet[A] to Ensuring[ORSet[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: (ORSet[A]) ⇒ Boolean): ORSet[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from ORSet[A] to Ensuring[ORSet[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean, msg: ⇒ Any): ORSet[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from ORSet[A] to Ensuring[ORSet[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. def ensuring(cond: Boolean): ORSet[A]

    Permalink
    Implicit information
    This member is added by an implicit conversion from ORSet[A] to Ensuring[ORSet[A]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  20. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  21. def equals(o: Any): Boolean

    Permalink
    Definition Classes
    ORSet → AnyRef → Any
  22. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from ORSet[A] to StringFormat[ORSet[A]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  24. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  25. def getElements(): Set[A]

    Permalink

    Java API

  26. def hashCode(): Int

    Permalink
    Definition Classes
    ORSet → AnyRef → Any
  27. def isEmpty: Boolean

    Permalink
  28. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  29. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  30. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. val originDc: DataCenter

    Permalink
  33. def remove(element: A): DeltaOp

    Permalink

    Removes an element from the set.

  34. def removeAll(elems: Set[A]): DeltaOp

    Permalink

    Scala API: Remove several elements from the set.

    Scala API: Remove several elements from the set. elems must not be empty.

  35. def removeAll(elems: Set[A]): DeltaOp

    Permalink

    Java API: Remove several elements from the set.

    Java API: Remove several elements from the set. elems must not be empty.

  36. def size: Int

    Permalink
  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  38. def toString(): String

    Permalink
    Definition Classes
    ORSet → AnyRef → Any
  39. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. def [B](y: B): (ORSet[A], B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from ORSet[A] to ArrowAssoc[ORSet[A]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from ORSet[A] to any2stringadd[ORSet[A]] performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is shadowed by one or more members in this class.
    To access this member you can use a type ascription:
    (oRSet: any2stringadd[ORSet[A]]).+(other)
    Definition Classes
    any2stringadd

Inherited from Serializable

Inherited from Serializable

Inherited from OpCrdt[DeltaOp]

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from ORSet[A] to any2stringadd[ORSet[A]]

Inherited by implicit conversion StringFormat from ORSet[A] to StringFormat[ORSet[A]]

Inherited by implicit conversion Ensuring from ORSet[A] to Ensuring[ORSet[A]]

Inherited by implicit conversion ArrowAssoc from ORSet[A] to ArrowAssoc[ORSet[A]]

Ungrouped