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
ORDictionary<TKey, TValue>
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>)
Declaration
public ORDictionary(ORSet<TKey> keySet, IImmutableDictionary<TKey, TValue> valueMap)
Parameters
Fields
|
Edit this page
View Source
Empty
Declaration
public static readonly ORDictionary<TKey, TValue> Empty
Field Value
Properties
|
Edit this page
View Source
Count
Declaration
public int Count { get; }
Property Value
|
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
|
Edit this page
View Source
Entries
Declaration
public IImmutableDictionary<TKey, TValue> Entries { get; }
Property Value
|
Edit this page
View Source
IsEmpty
Declaration
public bool IsEmpty { get; }
Property Value
|
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
|
Edit this page
View Source
KeyType
Declaration
public Type KeyType { get; }
Property Value
|
Edit this page
View Source
Keys
Declaration
public IEnumerable<TKey> Keys { get; }
Property Value
|
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
|
Edit this page
View Source
ValueType
Declaration
public Type ValueType { get; }
Property Value
|
Edit this page
View Source
Values
Declaration
public IEnumerable<TValue> Values { get; }
Property Value
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
|
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
|
Edit this page
View Source
ContainsKey(TKey)
Declaration
public bool ContainsKey(TKey key)
Parameters
Type |
Name |
Description |
TKey |
key |
|
Returns
|
Edit this page
View Source
Equals(ORDictionary<TKey, TValue>)
Declaration
public bool Equals(ORDictionary<TKey, TValue> other)
Parameters
Returns
|
Edit this page
View Source
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
object |
obj |
|
Returns
Overrides
|
Edit this page
View Source
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
|
Edit this page
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
|
Edit this page
View Source
Merge(IReplicatedData)
Declaration
public IReplicatedData Merge(IReplicatedData other)
Parameters
Returns
|
Edit this page
View Source
Merge(ORDictionary<TKey, TValue>)
Declaration
public ORDictionary<TKey, TValue> Merge(ORDictionary<TKey, TValue> other)
Parameters
Returns
|
Edit this page
View Source
MergeDelta(IDeltaOperation)
Declaration
public ORDictionary<TKey, TValue> MergeDelta(ORDictionary<TKey, TValue>.IDeltaOperation delta)
Parameters
Returns
|
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
Returns
|
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
Returns
|
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
Returns
|
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
|
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
Returns
|
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
|
Edit this page
View Source
SetItem(Cluster, TKey, TValue)
Declaration
public ORDictionary<TKey, TValue> SetItem(Cluster node, TKey key, TValue value)
Parameters
Type |
Name |
Description |
Cluster |
node |
|
TKey |
key |
|
TValue |
value |
|
Returns
|
Edit this page
View Source
SetItem(UniqueAddress, TKey, TValue)
Declaration
public ORDictionary<TKey, TValue> SetItem(UniqueAddress node, TKey key, TValue value)
Parameters
Returns
|
Edit this page
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
|
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
Implements
Extension Methods