Search Results for

    Show / Hide Table of Contents

    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
    object
    FastMerge<GCounter>
    GCounter
    Implements
    IRemovedNodePruning<GCounter>
    IRemovedNodePruning
    IEquatable<GCounter>
    IReplicatedDataSerialization
    IDeltaReplicatedData<GCounter, GCounter>
    IDeltaReplicatedData
    IReplicatedData<GCounter>
    IReplicatedDelta
    IReplicatedData
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Akka.DistributedData
    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

    | Edit this page View Source

    GCounter()

    TBD

    Declaration
    public GCounter()

    Properties

    | Edit this page View Source

    Delta

    The accumulated delta of mutator operations since previous ResetDelta(). When the Akka.DistributedData.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 Akka.DistributedData.Replicator with the Delta accessor. The modify function shall still return the full state in the same way as IReplicatedData<T> without support for deltas.

    Declaration
    public GCounter Delta { get; }
    Property Value
    Type Description
    GCounter
    | Edit this page View Source

    Empty

    TBD

    Declaration
    public static GCounter Empty { get; }
    Property Value
    Type Description
    GCounter
    | Edit this page View Source

    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.

    Declaration
    public ImmutableHashSet<UniqueAddress> ModifiedByNodes { get; }
    Property Value
    Type Description
    ImmutableHashSet<UniqueAddress>
    | Edit this page View Source

    State

    TBD

    Declaration
    public ImmutableDictionary<UniqueAddress, ulong> State { get; }
    Property Value
    Type Description
    ImmutableDictionary<UniqueAddress, ulong>
    | Edit this page View Source

    Value

    Current total value of the counter.

    Declaration
    public ulong Value { get; }
    Property Value
    Type Description
    ulong

    Methods

    | Edit this page View Source

    Equals(GCounter)

    Declaration
    public bool Equals(GCounter other)
    Parameters
    Type Name Description
    GCounter other
    Returns
    Type Description
    bool
    | Edit this page View Source

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    object.Equals(object)
    | Edit this page View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    object.GetHashCode()
    | Edit this page View Source

    Increment(Cluster, ulong)

    Increment the counter with the delta specified. The delta must be zero or positive.

    Declaration
    public GCounter Increment(Cluster node, ulong delta = 1)
    Parameters
    Type Name Description
    Cluster node
    ulong delta
    Returns
    Type Description
    GCounter
    | Edit this page View Source

    Increment(UniqueAddress, ulong)

    Increment the counter with the delta specified. The delta must be zero or positive.

    Declaration
    public GCounter Increment(UniqueAddress node, ulong n = 1)
    Parameters
    Type Name Description
    UniqueAddress node

    TBD

    ulong n

    TBD

    Returns
    Type Description
    GCounter

    TBD

    Exceptions
    Type Condition
    ArgumentException

    This exception is thrown when the specified n is less than zero.

    | Edit this page View Source

    Merge(GCounter)

    TBD

    Declaration
    public override GCounter Merge(GCounter other)
    Parameters
    Type Name Description
    GCounter other

    TBD

    Returns
    Type Description
    GCounter

    TBD

    Overrides
    FastMerge<GCounter>.Merge(GCounter)
    | Edit this page View Source

    MergeDelta(GCounter)

    When delta is merged into the full state this method is used. When the type GCounter of the delta is of the same type as the full state GCounter this method can be implemented by delegating to Merge(T).

    Declaration
    public GCounter MergeDelta(GCounter delta)
    Parameters
    Type Name Description
    GCounter delta
    Returns
    Type Description
    GCounter
    | Edit this page View Source

    NeedPruningFrom(UniqueAddress)

    TBD

    Declaration
    public bool NeedPruningFrom(UniqueAddress removedNode)
    Parameters
    Type Name Description
    UniqueAddress removedNode

    TBD

    Returns
    Type Description
    bool

    TBD

    | Edit this page View Source

    Prune(UniqueAddress, UniqueAddress)

    TBD

    Declaration
    public GCounter Prune(UniqueAddress removedNode, UniqueAddress collapseInto)
    Parameters
    Type Name Description
    UniqueAddress removedNode

    TBD

    UniqueAddress collapseInto

    TBD

    Returns
    Type Description
    GCounter

    TBD

    | Edit this page View Source

    PruningCleanup(UniqueAddress)

    TBD

    Declaration
    public GCounter PruningCleanup(UniqueAddress removedNode)
    Parameters
    Type Name Description
    UniqueAddress removedNode

    TBD

    Returns
    Type Description
    GCounter

    TBD

    | Edit this page View Source

    ResetDelta()

    Reset collection of deltas from mutator operations. When the Akka.DistributedData.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 Akka.DistributedData.Replicator with the Delta accessor. When the Akka.DistributedData.Replicator has grabbed the Delta it will invoke this method to get a clean data instance without the delta.

    Declaration
    public GCounter ResetDelta()
    Returns
    Type Description
    GCounter
    | Edit this page View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    string
    Overrides
    object.ToString()

    Operators

    | Edit this page View Source

    implicit operator ulong(GCounter)

    Performs an implicit conversion from GCounter to ulong.

    Declaration
    public static implicit operator ulong(GCounter counter)
    Parameters
    Type Name Description
    GCounter counter

    The counter to convert

    Returns
    Type Description
    ulong

    The result of the conversion

    Implements

    IRemovedNodePruning<T>
    IRemovedNodePruning
    IEquatable<T>
    IReplicatedDataSerialization
    IDeltaReplicatedData<T, TDelta>
    IDeltaReplicatedData
    IReplicatedData<T>
    IReplicatedDelta
    IReplicatedData

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET