Search Results for

    Show / Hide Table of Contents

    Class ORDictionary<TKey, TValue>

    Implements a 'Observed Remove Map' CRDT, also called a 'OR-Map'.

    It has similar semantics as an ORSet<T>, but in case of concurrent updates the values are merged, and must therefore be IReplicatedData types themselves.

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

    Inheritance
    object
    ORDictionary<TKey, TValue>
    Implements
    IEnumerable<KeyValuePair<TKey, TValue>>
    IEnumerable
    IRemovedNodePruning<ORDictionary<TKey, TValue>>
    IRemovedNodePruning
    IEquatable<ORDictionary<TKey, TValue>>
    IReplicatedDataSerialization
    IDeltaReplicatedData<ORDictionary<TKey, TValue>, ORDictionary<TKey, TValue>.IDeltaOperation>
    IDeltaReplicatedData
    IReplicatedData<ORDictionary<TKey, TValue>>
    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 ORDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>, IEnumerable, IRemovedNodePruning<ORDictionary<TKey, TValue>>, IRemovedNodePruning, IEquatable<ORDictionary<TKey, TValue>>, IReplicatedDataSerialization, IDeltaReplicatedData<ORDictionary<TKey, TValue>, ORDictionary<TKey, TValue>.IDeltaOperation>, IDeltaReplicatedData, IReplicatedData<ORDictionary<TKey, TValue>>, IReplicatedData where TValue : IReplicatedData<TValue>
    Type Parameters
    Name Description
    TKey
    TValue

    Constructors

    | Edit this page View Source

    ORDictionary(ORSet<TKey>, IImmutableDictionary<TKey, TValue>)

    Creates a new instance of the ORDictionary<TKey, TValue> class.

    Declaration
    public ORDictionary(ORSet<TKey> keySet, IImmutableDictionary<TKey, TValue> valueMap)
    Parameters
    Type Name Description
    ORSet<TKey> keySet
    IImmutableDictionary<TKey, TValue> valueMap

    Fields

    | Edit this page View Source

    Empty

    An empty instance of the ORDictionary<TKey, TValue>

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

    Properties

    | Edit this page View Source

    Count

    Returns number of entries stored within current ORDictionary<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, TValue>.IDeltaOperation Delta { get; }
    Property Value
    Type Description
    ORDictionary<TKey, TValue>.IDeltaOperation
    | Edit this page View Source

    Entries

    Returns all entries stored within current ORDictionary<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 ORDictionary<TKey, TValue> doesn't contain any value.

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

    this[TKey]

    Returns an element stored under provided key.

    Declaration
    public TValue this[TKey key] { get; }
    Parameters
    Type Name Description
    TKey key
    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 all keys stored within current ORDictionary<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 all values stored within current ORDictionary<TKey, TValue>

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

    Methods

    | Edit this page View Source

    AddOrUpdate(Cluster, TKey, TValue, Func<TValue, TValue>)

    Replace a value by applying the modify function on the existing value.

    If there is no current value for the key the initial value will be passed to the modify function.

    Declaration
    public ORDictionary<TKey, TValue> AddOrUpdate(Cluster node, TKey key, TValue initial, Func<TValue, TValue> modify)
    Parameters
    Type Name Description
    Cluster node
    TKey key
    TValue initial
    Func<TValue, TValue> modify
    Returns
    Type Description
    ORDictionary<TKey, TValue>
    | Edit this page View Source

    AddOrUpdate(UniqueAddress, TKey, TValue, Func<TValue, TValue>)

    Replace a value by applying the modify function on the existing value.

    If there is no current value for the key the initial value will be passed to the modify function.

    Declaration
    public ORDictionary<TKey, TValue> AddOrUpdate(UniqueAddress node, TKey key, TValue initial, Func<TValue, TValue> modify)
    Parameters
    Type Name Description
    UniqueAddress node
    TKey key
    TValue initial
    Func<TValue, TValue> modify
    Returns
    Type Description
    ORDictionary<TKey, TValue>
    | Edit this page View Source

    ContainsKey(TKey)

    Checks if provided key can be found inside current ORDictionary<TKey, TValue>

    Declaration
    public bool ContainsKey(TKey key)
    Parameters
    Type Name Description
    TKey key
    Returns
    Type Description
    bool
    | Edit this page View Source

    Equals(ORDictionary<TKey, TValue>)

    Declaration
    public bool Equals(ORDictionary<TKey, TValue> other)
    Parameters
    Type Name Description
    ORDictionary<TKey, TValue> 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

    GetEnumerator()

    Declaration
    public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
    Returns
    Type Description
    IEnumerator<KeyValuePair<TKey, TValue>>
    | 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)

    Declaration
    public IReplicatedData Merge(IReplicatedData other)
    Parameters
    Type Name Description
    IReplicatedData other
    Returns
    Type Description
    IReplicatedData
    | Edit this page View Source

    Merge(ORDictionary<TKey, TValue>)

    Monotonic merge method.

    Declaration
    public ORDictionary<TKey, TValue> Merge(ORDictionary<TKey, TValue> other)
    Parameters
    Type Name Description
    ORDictionary<TKey, TValue> other
    Returns
    Type Description
    ORDictionary<TKey, TValue>
    | Edit this page View Source

    MergeDelta(IDeltaOperation)

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

    Declaration
    public ORDictionary<TKey, TValue> MergeDelta(ORDictionary<TKey, TValue>.IDeltaOperation delta)
    Parameters
    Type Name Description
    ORDictionary<TKey, TValue>.IDeltaOperation delta
    Returns
    Type Description
    ORDictionary<TKey, TValue>
    | Edit this page View Source

    NeedPruningFrom(UniqueAddress)

    Does it have any state changes from a specific node, which has been removed from the cluster.

    Declaration
    public bool NeedPruningFrom(UniqueAddress removedNode)
    Parameters
    Type Name Description
    UniqueAddress removedNode
    Returns
    Type Description
    bool
    | Edit this page View Source

    Prune(UniqueAddress, UniqueAddress)

    When the removedNode node has been removed from the cluster the state changes from that node will be pruned by collapsing the data entries to another node.

    Declaration
    public ORDictionary<TKey, TValue> Prune(UniqueAddress removedNode, UniqueAddress collapseInto)
    Parameters
    Type Name Description
    UniqueAddress removedNode
    UniqueAddress collapseInto
    Returns
    Type Description
    ORDictionary<TKey, TValue>
    | Edit this page View Source

    PruningCleanup(UniqueAddress)

    Remove data entries from a node that has been removed from the cluster and already been pruned.

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

    SetItem(Cluster, TKey, TValue)

    Adds an entry to the map. Note that the new value will be merged with existing values on other nodes and the outcome depends on what IReplicatedData type that is used.

    Consider using AddOrUpdate instead of SetItem(Cluster, TKey, TValue) if you want modify existing entry.

    ArgumentException is thrown if you try to replace an existing ORSet<T> value, because important history can be lost when replacing the ORSet and undesired effects of merging will occur. Use ORMultiValueDictionary<TKey, TValue> or AddOrUpdate instead.

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

    SetItem(UniqueAddress, TKey, TValue)

    Adds an entry to the map. Note that the new value will be merged with existing values on other nodes and the outcome depends on what IReplicatedData type that is used.

    Consider using AddOrUpdate instead of SetItem(UniqueAddress, TKey, TValue) if you want modify existing entry.

    ArgumentException is thrown if you try to replace an existing ORSet<T> value, because important history can be lost when replacing the ORSet and undesired effects of merging will occur. Use ORMultiValueDictionary<TKey, TValue> or AddOrUpdate instead.

    Declaration
    public ORDictionary<TKey, TValue> SetItem(UniqueAddress node, TKey key, TValue value)
    Parameters
    Type Name Description
    UniqueAddress node
    TKey key
    TValue value
    Returns
    Type Description
    ORDictionary<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 retrieve value under provided key, returning true if value under that key has been found.

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

    Implements

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

    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