Search Results for

    Show / Hide Table of Contents

    Class LWWDictionary<TKey, TValue>

    Specialized LWWDictionary<TKey, TValue> with LWWRegister<T> values.

    LWWRegister<T> relies on synchronized clocks and should only be used when the choice of value is not important for concurrent updates occurring within the clock skew.

    Instead of using timestamps based on DateTime.UtcNow.Ticks time it is possible to use a timestamp value based on something else, for example an increasing version number from a database record that is used for optimistic concurrency control.

    For first-write-wins semantics you can use the ReverseClock instead of the DefaultClock

    This class is immutable, i.e. "modifying" methods return a new instance.

    Inheritance
    object
    LWWDictionary<TKey, TValue>
    Implements
    IDeltaReplicatedData<LWWDictionary<TKey, TValue>, ORDictionary<TKey, LWWRegister<TValue>>.IDeltaOperation>
    IDeltaReplicatedData
    IRemovedNodePruning<LWWDictionary<TKey, TValue>>
    IRemovedNodePruning
    IReplicatedData<LWWDictionary<TKey, TValue>>
    IReplicatedData
    IReplicatedDataSerialization
    IEquatable<LWWDictionary<TKey, TValue>>
    IEnumerable<KeyValuePair<TKey, TValue>>
    IEnumerable
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Akka.DistributedData
    Assembly: Akka.DistributedData.dll
    Syntax
    [Serializable]
    public sealed class LWWDictionary<TKey, TValue> : IDeltaReplicatedData<LWWDictionary<TKey, TValue>, ORDictionary<TKey, LWWRegister<TValue>>.IDeltaOperation>, IDeltaReplicatedData, IRemovedNodePruning<LWWDictionary<TKey, TValue>>, IRemovedNodePruning, IReplicatedData<LWWDictionary<TKey, TValue>>, IReplicatedData, IReplicatedDataSerialization, IEquatable<LWWDictionary<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable
    Type Parameters
    Name Description
    TKey

    TBD

    TValue

    TBD

    Constructors

    | Edit this page View Source

    LWWDictionary(ORDictionary<TKey, LWWRegister<TValue>>)

    TBD

    Declaration
    public LWWDictionary(ORDictionary<TKey, LWWRegister<TValue>> underlying)
    Parameters
    Type Name Description
    ORDictionary<TKey, LWWRegister<TValue>> underlying

    TBD

    Fields

    | Edit this page View Source

    Empty

    An empty instance of the LWWDictionary<TKey, TValue>

    Declaration
    public static readonly LWWDictionary<TKey, TValue> Empty
    Field Value
    Type Description
    LWWDictionary<TKey, TValue>

    Properties

    | Edit this page View Source

    Count

    Returns number of entries stored within current LWWDictionary<TKey, TValue>.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int
    | 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 ORDictionary<TKey, LWWRegister<TValue>>.IDeltaOperation Delta { get; }
    Property Value
    Type Description
    ORDictionary<TKey, LWWRegister<TValue>>.IDeltaOperation
    | Edit this page View Source

    Entries

    Returns all entries stored within current LWWDictionary<TKey, TValue>

    Declaration
    public IImmutableDictionary<TKey, TValue> Entries { get; }
    Property Value
    Type Description
    IImmutableDictionary<TKey, TValue>
    | Edit this page View Source

    IsEmpty

    Determines if current LWWDictionary<TKey, TValue> is empty.

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

    this[TKey]

    Returns value stored under provided key.

    Declaration
    public TValue this[TKey key] { get; }
    Parameters
    Type Name Description
    TKey key

    TBD

    Property Value
    Type Description
    TValue
    | Edit this page View Source

    KeyType

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

    Keys

    Returns collection of keys stored within current LWWDictionary<TKey, TValue>.

    Declaration
    public IEnumerable<TKey> Keys { get; }
    Property Value
    Type Description
    IEnumerable<TKey>
    | 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

    ValueType

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

    Values

    Returns collection of values stored within current LWWDictionary<TKey, TValue>.

    Declaration
    public IEnumerable<TValue> Values { get; }
    Property Value
    Type Description
    IEnumerable<TValue>

    Methods

    | Edit this page View Source

    ContainsKey(TKey)

    Determines current LWWDictionary<TKey, TValue> contains entry with provided key.

    Declaration
    public bool ContainsKey(TKey key)
    Parameters
    Type Name Description
    TKey key

    TBD

    Returns
    Type Description
    bool

    TBD

    | Edit this page View Source

    Equals(LWWDictionary<TKey, TValue>)

    TBD

    Declaration
    public bool Equals(LWWDictionary<TKey, TValue> other)
    Parameters
    Type Name Description
    LWWDictionary<TKey, TValue> other

    TBD

    Returns
    Type Description
    bool

    TBD

    | 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

    GetEnumerator()

    TBD

    Declaration
    public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
    Returns
    Type Description
    IEnumerator<KeyValuePair<TKey, TValue>>

    TBD

    | Edit this page View Source

    GetHashCode()

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

    Merge(IReplicatedData)

    TBD

    Declaration
    public IReplicatedData Merge(IReplicatedData other)
    Parameters
    Type Name Description
    IReplicatedData other

    TBD

    Returns
    Type Description
    IReplicatedData

    TBD

    | Edit this page View Source

    Merge(LWWDictionary<TKey, TValue>)

    TBD

    Declaration
    public LWWDictionary<TKey, TValue> Merge(LWWDictionary<TKey, TValue> other)
    Parameters
    Type Name Description
    LWWDictionary<TKey, TValue> other

    TBD

    Returns
    Type Description
    LWWDictionary<TKey, TValue>

    TBD

    | Edit this page View Source

    MergeDelta(IDeltaOperation)

    When delta is merged into the full state this method is used. When the type ORDictionary of the delta is of the same type as the full state LWWDictionary<TKey, TValue> this method can be implemented by delegating to Merge(T).

    Declaration
    public LWWDictionary<TKey, TValue> MergeDelta(ORDictionary<TKey, LWWRegister<TValue>>.IDeltaOperation delta)
    Parameters
    Type Name Description
    ORDictionary<TKey, LWWRegister<TValue>>.IDeltaOperation delta
    Returns
    Type Description
    LWWDictionary<TKey, TValue>
    | 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 LWWDictionary<TKey, TValue> Prune(UniqueAddress removedNode, UniqueAddress collapseInto)
    Parameters
    Type Name Description
    UniqueAddress removedNode

    TBD

    UniqueAddress collapseInto

    TBD

    Returns
    Type Description
    LWWDictionary<TKey, TValue>

    TBD

    | Edit this page View Source

    PruningCleanup(UniqueAddress)

    TBD

    Declaration
    public LWWDictionary<TKey, TValue> PruningCleanup(UniqueAddress removedNode)
    Parameters
    Type Name Description
    UniqueAddress removedNode

    TBD

    Returns
    Type Description
    LWWDictionary<TKey, TValue>

    TBD

    | Edit this page View Source

    Remove(Cluster, TKey)

    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.

    Declaration
    public LWWDictionary<TKey, TValue> Remove(Cluster node, TKey key)
    Parameters
    Type Name Description
    Cluster node
    TKey key
    Returns
    Type Description
    LWWDictionary<TKey, TValue>
    | Edit this page View Source

    Remove(UniqueAddress, TKey)

    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.

    Declaration
    public LWWDictionary<TKey, TValue> Remove(UniqueAddress node, TKey key)
    Parameters
    Type Name Description
    UniqueAddress node
    TKey key
    Returns
    Type Description
    LWWDictionary<TKey, TValue>
    | 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 LWWDictionary<TKey, TValue> ResetDelta()
    Returns
    Type Description
    LWWDictionary<TKey, TValue>
    | Edit this page View Source

    SetItem(Cluster, TKey, TValue, Clock<TValue>)

    Adds an entry to the map.

    You can provide your clock implementation instead of using timestamps based on DateTime.UtcNow.Ticks time. The timestamp can for example be an increasing version number from a database record that is used for optimistic concurrency control.

    Declaration
    public LWWDictionary<TKey, TValue> SetItem(Cluster node, TKey key, TValue value, Clock<TValue> clock = null)
    Parameters
    Type Name Description
    Cluster node
    TKey key
    TValue value
    Clock<TValue> clock
    Returns
    Type Description
    LWWDictionary<TKey, TValue>
    | Edit this page View Source

    SetItem(UniqueAddress, TKey, TValue, Clock<TValue>)

    Adds an entry to the map.

    You can provide your clock implementation instead of using timestamps based on DateTime.UtcNow.Ticks time. The timestamp can for example be an increasing version number from a database record that is used for optimistic concurrency control.

    Declaration
    public LWWDictionary<TKey, TValue> SetItem(UniqueAddress node, TKey key, TValue value, Clock<TValue> clock = null)
    Parameters
    Type Name Description
    UniqueAddress node
    TKey key
    TValue value
    Clock<TValue> clock
    Returns
    Type Description
    LWWDictionary<TKey, TValue>
    | Edit this page View Source

    ToString()

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

    TryGetValue(TKey, out TValue)

    Tries to return a value under provided key is such value exists.

    Declaration
    public bool TryGetValue(TKey key, out TValue value)
    Parameters
    Type Name Description
    TKey key

    TBD

    TValue value

    TBD

    Returns
    Type Description
    bool

    TBD

    Implements

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

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    EnumerableExtensions.Grouped<T>(IEnumerable<T>, int)
    Extensions.Concat<T>(IEnumerable<T>?, T)
    Extensions.Drop<T>(IEnumerable<T>, int)
    Extensions.ForEach<T>(IEnumerable<T>, Action<T>)
    Extensions.Head<T>(IEnumerable<T>)
    Extensions.TakeRight<T>(IEnumerable<T>, int)
    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