Class PNCounter
Implements a 'Increment/Decrement Counter' CRDT, also called a 'PN-Counter'.
It is described in the paper
A comprehensive study of Convergent and Commutative Replicated Data Types.
PN-Counters allow the counter to be incremented by tracking the
increments (P) separate from the decrements (N). Both P and N are represented
as two internal [[GCounter]]s. Merge is handled by merging the internal P and N
counters. The value of the counter is the value of the P _counter minus
the value of the N counter.
This class is immutable, i.e. "modifying" methods return a new instance.
Assembly: Akka.DistributedData.dll
Syntax
[Serializable]
public sealed class PNCounter : IDeltaReplicatedData<PNCounter, PNCounter>, IDeltaReplicatedData, IRemovedNodePruning<PNCounter>, IRemovedNodePruning, IReplicatedData<PNCounter>, IReplicatedDataSerialization, IEquatable<PNCounter>, IReplicatedDelta, IReplicatedData
Constructors
|
Improve this Doc
View Source
PNCounter()
Declaration
|
Improve this Doc
View Source
PNCounter(GCounter, GCounter)
Declaration
public PNCounter(GCounter increments, GCounter decrements)
Parameters
Fields
|
Improve this Doc
View Source
Empty
Declaration
public static readonly PNCounter Empty
Field Value
Properties
|
Improve this Doc
View Source
Decrements
Declaration
public GCounter Decrements { get; }
Property Value
|
Improve this Doc
View Source
Delta
Declaration
public PNCounter Delta { get; }
Property Value
|
Improve this Doc
View Source
Increments
Declaration
public GCounter Increments { get; }
Property Value
|
Improve this Doc
View Source
ModifiedByNodes
Declaration
public ImmutableHashSet<UniqueAddress> ModifiedByNodes { get; }
Property Value
Type |
Description |
System.Collections.Immutable.ImmutableHashSet<UniqueAddress> |
|
|
Improve this Doc
View Source
Value
Declaration
public BigInteger Value { get; }
Property Value
Methods
|
Improve this Doc
View Source
Decrement(Cluster, Int64)
Decrement the counter with the delta specified.
If the delta is negative then it will increment instead of decrement.
Declaration
public PNCounter Decrement(Cluster node, long delta = 1L)
Parameters
Returns
|
Improve this Doc
View Source
Decrement(UniqueAddress, Int64)
Decrement the counter with the delta specified.
If the delta is negative then it will increment instead of decrement.
Declaration
public PNCounter Decrement(UniqueAddress address, long delta = 1L)
Parameters
Returns
|
Improve this Doc
View Source
Equals(PNCounter)
Declaration
public bool Equals(PNCounter other)
Parameters
Returns
|
Improve this Doc
View Source
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
Overrides
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
|
Improve this Doc
View Source
Increment(Cluster, Int64)
Increment the counter with the delta specified.
If the delta is negative then it will decrement instead of increment.
Declaration
public PNCounter Increment(Cluster node, long delta = 1L)
Parameters
Returns
|
Improve this Doc
View Source
Increment(UniqueAddress, Int64)
Increment the counter with the delta specified.
If the delta is negative then it will decrement instead of increment.
Declaration
public PNCounter Increment(UniqueAddress address, long delta = 1L)
Parameters
Returns
|
Improve this Doc
View Source
Merge(IReplicatedData)
Declaration
public IReplicatedData Merge(IReplicatedData other)
Parameters
Returns
|
Improve this Doc
View Source
Merge(PNCounter)
Declaration
public PNCounter Merge(PNCounter other)
Parameters
Returns
|
Improve this Doc
View Source
MergeDelta(PNCounter)
Declaration
public PNCounter MergeDelta(PNCounter delta)
Parameters
Returns
|
Improve this Doc
View Source
NeedPruningFrom(UniqueAddress)
Declaration
public bool NeedPruningFrom(UniqueAddress removedNode)
Parameters
Returns
|
Improve this Doc
View Source
Prune(UniqueAddress, UniqueAddress)
Declaration
public PNCounter Prune(UniqueAddress removedNode, UniqueAddress collapseInto)
Parameters
Returns
|
Improve this Doc
View Source
PruningCleanup(UniqueAddress)
Declaration
public PNCounter PruningCleanup(UniqueAddress removedNode)
Parameters
Returns
|
Improve this Doc
View Source
ResetDelta()
Declaration
public PNCounter ResetDelta()
Returns
|
Improve this Doc
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
Explicit Interface Implementations
|
Improve this Doc
View Source
IDeltaReplicatedData.Delta
Declaration
IReplicatedDelta IDeltaReplicatedData.Delta { get; }
Returns
|
Improve this Doc
View Source
IDeltaReplicatedData.MergeDelta(IReplicatedDelta)
Declaration
IReplicatedData IDeltaReplicatedData.MergeDelta(IReplicatedDelta delta)
Parameters
Returns
|
Improve this Doc
View Source
IDeltaReplicatedData.ResetDelta()
Declaration
IReplicatedData IDeltaReplicatedData.ResetDelta()
Returns
|
Improve this Doc
View Source
IRemovedNodePruning.Prune(UniqueAddress, UniqueAddress)
Declaration
IReplicatedData IRemovedNodePruning.Prune(UniqueAddress removedNode, UniqueAddress collapseInto)
Parameters
Returns
|
Improve this Doc
View Source
IRemovedNodePruning.PruningCleanup(UniqueAddress)
Declaration
IReplicatedData IRemovedNodePruning.PruningCleanup(UniqueAddress removedNode)
Parameters
Returns
|
Improve this Doc
View Source
IReplicatedDelta.Zero
Declaration
IDeltaReplicatedData IReplicatedDelta.Zero { get; }
Returns
Implements
Extension Methods