Package akka.cluster.ddata
Class GCounter
- java.lang.Object
-
- akka.cluster.ddata.GCounter
-
- All Implemented Interfaces:
DeltaReplicatedData,FastMerge,RemovedNodePruning,ReplicatedData,ReplicatedDataSerialization,ReplicatedDelta,java.io.Serializable
public final class GCounter extends java.lang.Object implements DeltaReplicatedData, ReplicatedDelta, ReplicatedDataSerialization, RemovedNodePruning, FastMerge
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GCounter$colon$plus(long n, SelfUniqueAddress node)Increment the counter with the deltanspecified.static GCounterapply()static GCountercreate()Java APIscala.Option<GCounter>delta()The accumulated delta of mutator operations since previousDeltaReplicatedData.resetDelta().static GCounterempty()booleanequals(java.lang.Object o)java.math.BigIntegergetValue()Java API: Current total value of the counter.inthashCode()GCounterincrement(SelfUniqueAddress node, long n)Increment the counter with the deltanspecified.GCountermerge(GCounter that)GCountermergeDelta(GCounter thatDelta)scala.collection.immutable.Set<UniqueAddress>modifiedByNodes()The nodes that have changed the state for this data and would need pruning when such node is no longer part of the cluster.booleanneedPruningFrom(UniqueAddress removedNode)Does it have any state changes from a specific node, which has been removed from the cluster.GCounterprune(UniqueAddress removedNode, UniqueAddress collapseInto)When theremovednode has been removed from the cluster the state changes from that node will be pruned by collapsing the data entries to another node.GCounterpruningCleanup(UniqueAddress removedNode)Remove data entries from a node that has been removed from the cluster and already been pruned.GCounterresetDelta()Reset collection of deltas from mutator operations.java.lang.StringtoString()static scala.Option<scala.math.BigInt>unapply(GCounter c)Extract thevalue().scala.math.BigIntvalue()Scala API: Current total value of the counter.GCounterzero()The empty full state.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface akka.cluster.ddata.DeltaReplicatedData
mergeDelta
-
Methods inherited from interface akka.cluster.ddata.FastMerge
ancestor_$eq, assignAncestor, clearAncestor, isAncestorOf
-
Methods inherited from interface akka.cluster.ddata.ReplicatedData
merge
-
-
-
-
Method Detail
-
empty
public static GCounter empty()
-
apply
public static GCounter apply()
-
create
public static GCounter create()
Java API
-
delta
public scala.Option<GCounter> 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
-
value
public scala.math.BigInt value()
Scala API: Current total value of the counter.
-
getValue
public java.math.BigInteger getValue()
Java API: Current total value of the counter.
-
$colon$plus
public GCounter $colon$plus(long n, SelfUniqueAddress node)
Increment the counter with the deltanspecified. The delta must be zero or positive.
-
increment
public GCounter increment(SelfUniqueAddress node, long n)
Increment the counter with the deltanspecified. The deltanmust be zero or positive.
-
zero
public GCounter 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
public GCounter 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
-
modifiedByNodes
public scala.collection.immutable.Set<UniqueAddress> modifiedByNodes()
Description copied from interface:RemovedNodePruningThe nodes that have changed the state for this data and would need pruning when such node is no longer part of the cluster.- Specified by:
modifiedByNodesin interfaceRemovedNodePruning
-
needPruningFrom
public boolean needPruningFrom(UniqueAddress removedNode)
Description copied from interface:RemovedNodePruningDoes it have any state changes from a specific node, which has been removed from the cluster.- Specified by:
needPruningFromin interfaceRemovedNodePruning
-
prune
public GCounter prune(UniqueAddress removedNode, UniqueAddress collapseInto)
Description copied from interface:RemovedNodePruningWhen theremovednode has been removed from the cluster the state changes from that node will be pruned by collapsing the data entries to another node.- Specified by:
prunein interfaceRemovedNodePruning
-
pruningCleanup
public GCounter pruningCleanup(UniqueAddress removedNode)
Description copied from interface:RemovedNodePruningRemove data entries from a node that has been removed from the cluster and already been pruned.- Specified by:
pruningCleanupin interfaceRemovedNodePruning
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-