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
LWWDictionary<TKey, TValue>
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
|
Improve this Doc
View Source
LWWDictionary(ORDictionary<TKey, LWWRegister<TValue>>)
Declaration
public LWWDictionary(ORDictionary<TKey, LWWRegister<TValue>> underlying)
Parameters
Fields
|
Improve this Doc
View Source
Empty
Declaration
public static readonly LWWDictionary<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, LWWRegister<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 value stored under provided key
.
Declaration
public TValue this[TKey key] { get; }
Parameters
Type |
Name |
Description |
TKey |
key |
TBD
|
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
ContainsKey(TKey)
Declaration
public bool ContainsKey(TKey key)
Parameters
Type |
Name |
Description |
TKey |
key |
TBD
|
Returns
|
Improve this Doc
View Source
Equals(LWWDictionary<TKey, TValue>)
Declaration
public bool Equals(LWWDictionary<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(LWWDictionary<TKey, TValue>)
Declaration
public LWWDictionary<TKey, TValue> Merge(LWWDictionary<TKey, TValue> other)
Parameters
Returns
|
Improve this Doc
View Source
MergeDelta(ORDictionary<TKey, LWWRegister<TValue>>.IDeltaOperation)
Declaration
public LWWDictionary<TKey, TValue> MergeDelta(ORDictionary<TKey, LWWRegister<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 LWWDictionary<TKey, TValue> Prune(UniqueAddress removedNode, UniqueAddress collapseInto)
Parameters
Returns
|
Improve this Doc
View Source
PruningCleanup(UniqueAddress)
Declaration
public LWWDictionary<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 LWWDictionary<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 LWWDictionary<TKey, TValue> Remove(UniqueAddress node, TKey key)
Parameters
Returns
|
Improve this Doc
View Source
ResetDelta()
Declaration
public LWWDictionary<TKey, TValue> ResetDelta()
Returns
|
Improve this Doc
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
|
Improve this Doc
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
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 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
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