Class GCounter
Implements a 'Growing Counter' CRDT, also called a 'G-Counter'.
It is described in the paper
A comprehensive study of Convergent and Commutative Replicated Data Types.
A G-Counter is a increment-only counter (inspired by vector clocks) in
which only increment and merge are possible. Incrementing the counter
adds 1 to the count for the current node. Divergent histories are
resolved by taking the maximum count for each node (like a vector
clock merge). The value of the counter is the sum of all node counts.
This class is immutable, i.e. "modifying" methods return a new instance.
Inheritance
Akka.DistributedData.FastMerge<
GCounter>
GCounter
Assembly: Akka.DistributedData.dll
Syntax
[Serializable]
public sealed class GCounter : FastMerge<GCounter>, IRemovedNodePruning<GCounter>, IRemovedNodePruning, IEquatable<GCounter>, IReplicatedDataSerialization, IDeltaReplicatedData<GCounter, GCounter>, IDeltaReplicatedData, IReplicatedData<GCounter>, IReplicatedDelta, IReplicatedData
Constructors
|
Improve this Doc
View Source
GCounter()
Declaration
Properties
|
Improve this Doc
View Source
Delta
Declaration
public GCounter Delta { get; }
Property Value
|
Improve this Doc
View Source
Empty
Declaration
public static GCounter Empty { 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
State
Declaration
public ImmutableDictionary<UniqueAddress, ulong> State { get; }
Property Value
|
Improve this Doc
View Source
Value
Current total value of the counter.
Declaration
public ulong Value { get; }
Property Value
Methods
|
Improve this Doc
View Source
Equals(GCounter)
Declaration
public bool Equals(GCounter 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, UInt64)
Increment the counter with the delta specified. The delta must be zero or positive.
Declaration
public GCounter Increment(Cluster node, ulong delta = 1UL)
Parameters
Returns
|
Improve this Doc
View Source
Increment(UniqueAddress, UInt64)
Increment the counter with the delta specified. The delta must be zero or positive.
Declaration
public GCounter Increment(UniqueAddress node, ulong n = 1UL)
Parameters
Returns
Exceptions
Type |
Condition |
ArgumentException |
This exception is thrown when the specified n is less than zero.
|
|
Improve this Doc
View Source
Merge(GCounter)
Declaration
public override GCounter Merge(GCounter other)
Parameters
Type |
Name |
Description |
GCounter |
other |
TBD
|
Returns
Overrides
Akka.DistributedData.FastMerge<Akka.DistributedData.GCounter>.Merge(Akka.DistributedData.GCounter)
|
Improve this Doc
View Source
MergeDelta(GCounter)
Declaration
public GCounter MergeDelta(GCounter 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 GCounter Prune(UniqueAddress removedNode, UniqueAddress collapseInto)
Parameters
Returns
|
Improve this Doc
View Source
PruningCleanup(UniqueAddress)
Declaration
public GCounter PruningCleanup(UniqueAddress removedNode)
Parameters
Returns
|
Improve this Doc
View Source
ResetDelta()
Declaration
public GCounter ResetDelta()
Returns
|
Improve this Doc
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
Operators
|
Improve this Doc
View Source
Implicit(GCounter to UInt64)
Declaration
public static implicit operator ulong (GCounter counter)
Parameters
Type |
Name |
Description |
GCounter |
counter |
The counter to convert
|
Returns
Type |
Description |
UInt64 |
The result of the conversion
|
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