Package org.apache.pekko.cluster.ddata
Class GSet<A>
java.lang.Object
org.apache.pekko.cluster.ddata.GSet<A>
- All Implemented Interfaces:
Serializable,DeltaReplicatedData,FastMerge,ReplicatedData,ReplicatedDataSerialization,ReplicatedDelta,scala.Equals,scala.Product
public final class GSet<A>
extends Object
implements DeltaReplicatedData, ReplicatedDelta, ReplicatedDataSerialization, FastMerge, scala.Product, Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an element to the setAdds an element to the setapply()static <A> GSet<A>Implements a 'Add Set' CRDT, also called a 'G-Set'.booleanbooleanstatic <A> GSet<A>create()Java APIdelta()The accumulated delta of mutator operations since previousDeltaReplicatedData.resetDelta().scala.collection.immutable.Set<A>elements()static <A> GSet<A>empty()booleanJava APIinthashCode()booleanisEmpty()mergeDelta(GSet<A> thatDelta) intproductElement(int x$1) productElementName(int x$1) scala.collection.Iterator<Object>Reset collection of deltas from mutator operations.intsize()toString()static <A> scala.Option<scala.collection.immutable.Set<A>>zero()The empty full state.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pekko.cluster.ddata.DeltaReplicatedData
mergeDeltaMethods inherited from interface org.apache.pekko.cluster.ddata.FastMerge
ancestor_$eq, assignAncestor, clearAncestor, isAncestorOfMethods inherited from interface scala.Product
productElementNamesMethods inherited from interface org.apache.pekko.cluster.ddata.ReplicatedData
merge
-
Constructor Details
-
GSet
public GSet()
-
-
Method Details
-
empty
-
apply
-
create
Java API -
apply
public static <A> GSet<A> apply(scala.collection.immutable.Set<A> elements, scala.Option<GSet<A>> delta) Implements a 'Add Set' CRDT, also called a 'G-Set'. You can't remove elements of a G-Set.It is described in the paper A comprehensive study of Convergent and Commutative Replicated Data Types.
A G-Set doesn't accumulate any garbage apart from the elements themselves.
This class is immutable, i.e. "modifying" methods return a new instance.
-
unapply
-
elements
-
delta
Description copied from interface:DeltaReplicatedDataThe accumulated delta of mutator operations since previousDeltaReplicatedData.resetDelta(). When theReplicatorinvokes themodifyfunction of theUpdatemessage and the user code is invoking one or more mutator operations the data is collecting the delta of the operations and makes it available for theReplicatorwith theDeltaReplicatedData.delta()accessor. Themodifyfunction shall still return the full state in the same way asReplicatedDatawithout support for deltas.- Specified by:
deltain interfaceDeltaReplicatedData
-
getElements
Java API -
contains
-
isEmpty
public boolean isEmpty() -
size
public int size() -
$plus
Adds an element to the set -
add
Adds an element to the set -
merge
-
mergeDelta
-
zero
Description copied from interface:ReplicatedDeltaThe empty full state. This is used when a delta is received and no existing full state exists on the receiving side. Then the delta is merged into thezeroto create the initial full state.- Specified by:
zeroin interfaceReplicatedDelta
-
resetDelta
Description copied from interface:DeltaReplicatedDataReset collection of deltas from mutator operations. When theReplicatorinvokes themodifyfunction of theUpdatemessage the delta is always "reset" and when the user code is invoking one or more mutator operations the data is collecting the delta of the operations and makes it available for theReplicatorwith theDeltaReplicatedData.delta()accessor. When theReplicatorhas grabbed thedeltait will invoke this method to get a clean data instance without the delta.- Specified by:
resetDeltain interfaceDeltaReplicatedData
-
toString
-
copy
-
productPrefix
- Specified by:
productPrefixin interfacescala.Product
-
productArity
public int productArity()- Specified by:
productArityin interfacescala.Product
-
productElement
- Specified by:
productElementin interfacescala.Product
-
productIterator
- Specified by:
productIteratorin interfacescala.Product
-
canEqual
- Specified by:
canEqualin interfacescala.Equals
-
productElementName
- Specified by:
productElementNamein interfacescala.Product
-
hashCode
public int hashCode() -
equals
-