Package org.apache.pekko.cluster.ddata
Class PNCounterMap<A>
java.lang.Object
org.apache.pekko.cluster.ddata.PNCounterMap<A>
- All Implemented Interfaces:
Serializable,DeltaReplicatedData,RemovedNodePruning,ReplicatedData,ReplicatedDataSerialization
public final class PNCounterMap<A>
extends Object
implements DeltaReplicatedData, ReplicatedDataSerialization, RemovedNodePruning
Map of named counters. Specialized
ORMap with PNCounter values.
This class is immutable, i.e. "modifying" methods return a new instance.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> PNCounterMap<A>apply()booleanstatic <A> PNCounterMap<A>create()Java APIdecrement(SelfUniqueAddress node, A key, long delta) Decrement the counter with the delta specified.decrementBy(A key, long delta, SelfUniqueAddress node) Decrement the counter with the delta specified.longscala.Option<ORMap.DeltaOp>delta()The accumulated delta of mutator operations since previousDeltaReplicatedData.resetDelta().static <A> PNCounterMap<A>empty()scala.collection.immutable.Map<A,scala.math.BigInt> entries()Scala APIbooleanscala.Option<scala.math.BigInt>Scala API: The count for a keyJava APIJava API: The count for a key, ornullif it doesn't existinthashCode()Increment the counter with the delta specified.increment(SelfUniqueAddress node, A key, long delta) Increment the counter with the delta specified.longincrementBy(A key, long delta, SelfUniqueAddress node) Increment the counter with the delta specified.booleanisEmpty()merge(PNCounterMap<A> that) mergeDelta(ORMap.DeltaOp thatDelta) scala.collection.immutable.Set<UniqueAddress>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.prune(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.pruningCleanup(UniqueAddress removedNode) Remove data entries from a node that has been removed from the cluster and already been pruned.remove(A key, SelfUniqueAddress node) Removes an entry from the map.Reset collection of deltas from mutator operations.intsize()toString()static <A> scala.Option<scala.collection.immutable.Map<A,scala.math.BigInt>> unapply(PNCounterMap<A> m) Extract theentries().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.ReplicatedData
merge
-
Method Details
-
empty
-
apply
-
create
Java API -
unapply
public static <A> scala.Option<scala.collection.immutable.Map<A,scala.math.BigInt>> unapply(PNCounterMap<A> m) Extract theentries(). -
entries
Scala API -
getEntries
Java API -
get
Scala API: The count for a key -
getValue
Java API: The count for a key, ornullif it doesn't exist -
contains
-
isEmpty
public boolean isEmpty() -
size
public int size() -
incrementBy
Increment the counter with the delta specified. If the delta is negative then it will decrement instead of increment. -
increment
Increment the counter with the delta specified. If the delta is negative then it will decrement instead of increment. -
increment
Increment the counter with the delta specified. If the delta is negative then it will decrement instead of increment. -
increment$default$2
public long increment$default$2() -
decrementBy
Decrement the counter with the delta specified. If the delta is negative then it will increment instead of decrement. TODO add implicit after deprecated is EOL. -
decrement
Decrement the counter with the delta specified. If the delta is negative then it will increment instead of decrement. TODO add implicit after deprecated is EOL. -
decrementBy$default$2
public long decrementBy$default$2() -
remove
Removes an entry from the map. Note that if there is a conflicting update on another node the entry will not be removed after merge. -
merge
-
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
-
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
-
mergeDelta
-
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
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
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
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
-
equals
-
hashCode
public int hashCode()
-