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:
  • Method Details

    • 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 the entries().
    • entries

      public scala.collection.immutable.Map<A,scala.math.BigInt> entries()
      Scala API
    • getEntries

      public Map<A,BigInteger> getEntries()
      Java API
    • get

      public scala.Option<scala.math.BigInt> get(A key)
      Scala API: The count for a key
    • getValue

      public BigInteger getValue(A key)
      Java API: The count for a key, or null 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$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.
    • decrementBy$default$2

      public long decrementBy$default$2()
    • 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.
    • 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 the Replicator invokes the modify function of the Update 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 the Replicator with the DeltaReplicatedData.delta() accessor. When the Replicator has grabbed the delta it will invoke this method to get a clean data instance without the delta.
      Specified by:
      resetDelta in interface DeltaReplicatedData
    • delta

      public scala.Option<ORMap.DeltaOp> delta()
      Description copied from interface: DeltaReplicatedData
      The accumulated delta of mutator operations since previous DeltaReplicatedData.resetDelta(). When the Replicator invokes the modify function of the Update 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 the Replicator with the DeltaReplicatedData.delta() accessor. The modify function shall still return the full state in the same way as ReplicatedData without support for deltas.
      Specified by:
      delta in interface DeltaReplicatedData
    • 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 interface RemovedNodePruning
    • 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 interface RemovedNodePruning
    • prune

      public PNCounterMap<A> prune(UniqueAddress removedNode, UniqueAddress collapseInto)
      Description copied from interface: RemovedNodePruning
      When the removed 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 interface RemovedNodePruning
    • 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 interface RemovedNodePruning
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object