Package akka.cluster.ddata
Class PNCounterMap<A>
- java.lang.Object
-
- akka.cluster.ddata.PNCounterMap<A>
-
- All Implemented Interfaces:
DeltaReplicatedData
,RemovedNodePruning
,ReplicatedData
,ReplicatedDataSerialization
,java.io.Serializable
public final class PNCounterMap<A> extends java.lang.Object implements DeltaReplicatedData, ReplicatedDataSerialization, RemovedNodePruning
Map of named counters. SpecializedORMap
withPNCounter
values.This class is immutable, i.e. "modifying" methods return a new instance.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PNCounterMap.PNCounterMapTag$
INTERNAL API
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PNCounterMap<A>
$minus(A key, Cluster node)
Deprecated.Use `remove` that takes a `SelfUniqueAddress` parameter instead.static <A> PNCounterMap<A>
apply()
boolean
contains(A key)
static <A> PNCounterMap<A>
create()
Java APIPNCounterMap<A>
decrement(Cluster node, A key, long delta)
Deprecated.Use `decrement` that takes a `SelfUniqueAddress` parameter instead.PNCounterMap<A>
decrement(SelfUniqueAddress node, A key, long delta)
Decrement the counter with the delta specified.PNCounterMap<A>
decrement(A key, long delta, Cluster node)
Deprecated.Use `decrement` that takes a `SelfUniqueAddress` parameter instead.long
decrement$default$2()
Decrement the counter with the delta specified.PNCounterMap<A>
decrementBy(A key, long delta, SelfUniqueAddress node)
Decrement the counter with the delta specified.long
decrementBy$default$2()
scala.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 APIboolean
equals(java.lang.Object o)
scala.Option<scala.math.BigInt>
get(A key)
Scala API: The count for a keyjava.util.Map<A,java.math.BigInteger>
getEntries()
Java APIjava.math.BigInteger
getValue(A key)
Java API: The count for a key, ornull
if it doesn't existint
hashCode()
PNCounterMap<A>
increment(Cluster node, A key, long delta)
Deprecated.Use `increment` that takes a `SelfUniqueAddress` parameter instead.PNCounterMap<A>
increment(SelfUniqueAddress node, A key, long delta)
Increment the counter with the delta specified.PNCounterMap<A>
increment(A key, long delta, Cluster node)
Increment the counter with the delta specified.long
increment$default$2()
PNCounterMap<A>
incrementBy(A key, long delta, SelfUniqueAddress node)
Increment the counter with the delta specified.boolean
isEmpty()
PNCounterMap<A>
merge(PNCounterMap<A> that)
PNCounterMap<A>
mergeDelta(ORMap.DeltaOp 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.boolean
needPruningFrom(UniqueAddress removedNode)
Does it have any state changes from a specific node, which has been removed from the cluster.PNCounterMap<A>
prune(UniqueAddress removedNode, UniqueAddress collapseInto)
When theremoved
node has been removed from the cluster the state changes from that node will be pruned by collapsing the data entries to another node.PNCounterMap<A>
pruningCleanup(UniqueAddress removedNode)
Remove data entries from a node that has been removed from the cluster and already been pruned.PNCounterMap<A>
remove(Cluster node, A key)
Deprecated.Use `remove` that takes a `SelfUniqueAddress` parameter instead.PNCounterMap<A>
remove(A key, SelfUniqueAddress node)
Removes an entry from the map.PNCounterMap<A>
resetDelta()
Reset collection of deltas from mutator operations.int
size()
java.lang.String
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, wait
-
Methods inherited from interface akka.cluster.ddata.DeltaReplicatedData
mergeDelta
-
Methods inherited from interface akka.cluster.ddata.ReplicatedData
merge
-
-
-
-
Method Detail
-
empty
public static <A> PNCounterMap<A> empty()
-
apply
public static <A> PNCounterMap<A> apply()
-
create
public static <A> PNCounterMap<A> create()
Java API
-
unapply
public static <A> scala.Option<scala.collection.immutable.Map<A,scala.math.BigInt>> unapply(PNCounterMap<A> m)
Extract theentries()
.
-
entries
public scala.collection.immutable.Map<A,scala.math.BigInt> entries()
Scala API
-
getEntries
public java.util.Map<A,java.math.BigInteger> getEntries()
Java API
-
get
public scala.Option<scala.math.BigInt> get(A key)
Scala API: The count for a key
-
getValue
public java.math.BigInteger getValue(A key)
Java API: The count for a key, ornull
if it doesn't exist
-
contains
public boolean contains(A key)
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
incrementBy
public PNCounterMap<A> incrementBy(A key, long delta, SelfUniqueAddress node)
Increment the counter with the delta specified. If the delta is negative then it will decrement instead of increment.
-
increment
public PNCounterMap<A> increment(A key, long delta, Cluster node)
Increment the counter with the delta specified. If the delta is negative then it will decrement instead of increment.
-
increment
public PNCounterMap<A> increment(SelfUniqueAddress node, A key, long delta)
Increment the counter with the delta specified. If the delta is negative then it will decrement instead of increment.
-
increment
public PNCounterMap<A> increment(Cluster node, A key, long delta)
Deprecated.Use `increment` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
-
increment$default$2
public long increment$default$2()
-
decrementBy
public PNCounterMap<A> decrementBy(A key, long delta, SelfUniqueAddress node)
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
public PNCounterMap<A> decrement(SelfUniqueAddress node, A key, long delta)
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
public PNCounterMap<A> decrement(A key, long delta, Cluster node)
Deprecated.Use `decrement` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
-
decrement
public PNCounterMap<A> decrement(Cluster node, A key, long delta)
Deprecated.Use `decrement` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.Decrement the counter with the delta specified. If the delta is negative then it will increment instead of decrement.
-
decrementBy$default$2
public long decrementBy$default$2()
-
decrement$default$2
public long decrement$default$2()
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.
-
remove
public PNCounterMap<A> remove(A key, SelfUniqueAddress node)
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.
-
remove
public PNCounterMap<A> remove(Cluster node, A key)
Deprecated.Use `remove` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
-
$minus
public PNCounterMap<A> $minus(A key, Cluster node)
Deprecated.Use `remove` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
-
merge
public PNCounterMap<A> merge(PNCounterMap<A> that)
-
resetDelta
public PNCounterMap<A> resetDelta()
Description copied from interface:DeltaReplicatedData
Reset collection of deltas from mutator operations. When theReplicator
invokes themodify
function of theUpdate
message 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 theReplicator
with theDeltaReplicatedData.delta()
accessor. When theReplicator
has grabbed thedelta
it will invoke this method to get a clean data instance without the delta.- Specified by:
resetDelta
in interfaceDeltaReplicatedData
-
delta
public scala.Option<ORMap.DeltaOp> delta()
Description copied from interface:DeltaReplicatedData
The accumulated delta of mutator operations since previousDeltaReplicatedData.resetDelta()
. When theReplicator
invokes themodify
function of theUpdate
message 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 theReplicator
with theDeltaReplicatedData.delta()
accessor. Themodify
function shall still return the full state in the same way asReplicatedData
without support for deltas.- Specified by:
delta
in interfaceDeltaReplicatedData
-
mergeDelta
public PNCounterMap<A> mergeDelta(ORMap.DeltaOp thatDelta)
-
modifiedByNodes
public scala.collection.immutable.Set<UniqueAddress> modifiedByNodes()
Description copied from interface:RemovedNodePruning
The 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:
modifiedByNodes
in interfaceRemovedNodePruning
-
needPruningFrom
public boolean needPruningFrom(UniqueAddress removedNode)
Description copied from interface:RemovedNodePruning
Does it have any state changes from a specific node, which has been removed from the cluster.- Specified by:
needPruningFrom
in interfaceRemovedNodePruning
-
prune
public PNCounterMap<A> prune(UniqueAddress removedNode, UniqueAddress collapseInto)
Description copied from interface:RemovedNodePruning
When theremoved
node 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:
prune
in interfaceRemovedNodePruning
-
pruningCleanup
public PNCounterMap<A> pruningCleanup(UniqueAddress removedNode)
Description copied from interface:RemovedNodePruning
Remove data entries from a node that has been removed from the cluster and already been pruned.- Specified by:
pruningCleanup
in interfaceRemovedNodePruning
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-