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
|
Improve this Doc
View Source
ORDictionary(ORSet<TKey>, IImmutableDictionary<TKey, TValue>)
Declaration
public ORDictionary(ORSet<TKey> keySet, IImmutableDictionary<TKey, TValue> valueMap)
Parameters
Type |
Name |
Description |
ORSet<TKey> |
keySet |
|
System.Collections.Immutable.IImmutableDictionary<TKey, TValue> |
valueMap |
|
Fields
|
Improve this Doc
View Source
Empty
Declaration
public static readonly ORDictionary<TKey, TValue> Empty
Field Value
Properties
|
Improve this Doc
View Source
Count
Declaration
public int Count { get; }
Property Value
|
Improve this Doc
View Source
Delta
Declaration
public ORDictionary<TKey, TValue>.IDeltaOperation Delta { get; }
Property Value
|
Improve this Doc
View Source
Entries
Declaration
public IImmutableDictionary<TKey, TValue> Entries { get; }
Property Value
Type |
Description |
System.Collections.Immutable.IImmutableDictionary<TKey, TValue> |
|
|
Improve this Doc
View Source
IsEmpty
Declaration
public bool IsEmpty { get; }
Property Value
|
Improve this Doc
View Source
Item[TKey]
Returns an element stored under provided key
.
Declaration
public TValue this[TKey key] { get; }
Parameters
Type |
Name |
Description |
TKey |
key |
|
Property Value
|
Improve this Doc
View Source
Keys
Declaration
public IEnumerable<TKey> Keys { get; }
Property Value
|
Improve this Doc
View Source
KeyType
Declaration
public Type KeyType { 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
Values
Declaration
public IEnumerable<TValue> Values { get; }
Property Value
|
Improve this Doc
View Source
ValueType
Declaration
public Type ValueType { get; }
Property Value
Methods
|
Improve this Doc
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
|
Improve this Doc
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
|
Improve this Doc
View Source
ContainsKey(TKey)
Declaration
public bool ContainsKey(TKey key)
Parameters
Type |
Name |
Description |
TKey |
key |
|
Returns
|
Improve this Doc
View Source
Equals(ORDictionary<TKey, TValue>)
Declaration
public bool Equals(ORDictionary<TKey, TValue> 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
GetEnumerator()
Declaration
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Returns
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Overrides
|
Improve this Doc
View Source
Merge(IReplicatedData)
Declaration
public IReplicatedData Merge(IReplicatedData other)
Parameters
Returns
|
Improve this Doc
View Source
Merge(ORDictionary<TKey, TValue>)
Declaration
public ORDictionary<TKey, TValue> Merge(ORDictionary<TKey, TValue> other)
Parameters
Returns
|
Improve this Doc
View Source
MergeDelta(ORDictionary<TKey, TValue>.IDeltaOperation)
Declaration
public ORDictionary<TKey, TValue> MergeDelta(ORDictionary<TKey, TValue>.IDeltaOperation 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 ORDictionary<TKey, TValue> Prune(UniqueAddress removedNode, UniqueAddress collapseInto)
Parameters
Returns
|
Improve this Doc
View Source
PruningCleanup(UniqueAddress)
Declaration
public ORDictionary<TKey, TValue> PruningCleanup(UniqueAddress removedNode)
Parameters
Returns
|
Improve this Doc
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
|
Improve this Doc
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
|
Improve this Doc
View Source
ResetDelta()
Declaration
public ORDictionary<TKey, TValue> ResetDelta()
Returns
|
Improve this Doc
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
|
Improve this Doc
View Source
SetItem(UniqueAddress, TKey, TValue)
Declaration
public ORDictionary<TKey, TValue> SetItem(UniqueAddress node, TKey key, TValue value)
Parameters
Returns
|
Improve this Doc
View Source
ToString()
Declaration
public override string ToString()
Returns
Overrides
|
Improve this Doc
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
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
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Implements
Extension Methods