Click or drag to resize
Akka.NETLWWRegisterT Class
Implements a 'Last Writer Wins Register' CRDT, also called a 'LWW-Register'. It is described in the paper A comprehensive study of Convergent and Commutative Replicated Data Types. Merge takes the register with highest timestamp. Note that this relies on synchronized clocks. LWWRegisterT should only be used when the choice of value is not important for concurrent updates occurring within the clock skew. Merge takes the register updated by the node with lowest address (UniqueAddress is ordered) if the timestamps are exactly the same. Instead of using timestamps based on `DateTime.UtcNow` 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 [[LWWRegister#defaultClock]] This class is immutable, i.e. "modifying" methods return a new instance.
Inheritance Hierarchy
SystemObject
  Akka.DistributedDataLWWRegisterT

Namespace:  Akka.DistributedData
Assembly:  Akka.DistributedData (in Akka.DistributedData.dll) Version: 1.2.3.129 (1.2.3.129)
Syntax
[SerializableAttribute]
public class LWWRegister<T> : IReplicatedData<LWWRegister<T>>, 
	IReplicatedData, IReplicatedDataSerialization, IEquatable<LWWRegister<T>>

Type Parameters

T
TBD

The LWWRegisterT type exposes the following members.

Constructors
Properties
  NameDescription
Public propertyTimestamp
Returns a timestamp used to determine precedence in current register updates.
Public propertyUpdatedBy
Returns a unique address of the last cluster node, that updated current register value.
Public propertyValue
Returns value of the current register.
Top
Methods
  NameDescription
Public methodEquals(Object)
Determines whether the specified object is equal to the current object.
(Overrides ObjectEquals(Object).)
Public methodEquals(LWWRegisterT)
Indicates whether the current object is equal to another object of the same type.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Overrides ObjectGetHashCode.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMerge(IReplicatedData)
TBD
Public methodMerge(LWWRegisterT)
TBD
Public methodToString
Returns a string that represents the current object.
(Overrides ObjectToString.)
Public methodWithValue
Change the value of the register. 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.
Top
Fields
  NameDescription
Public fieldStatic memberDefaultClock
Default clock is using max between DateTime.UtcNow.Ticks and current timestamp + 1.
Public fieldStatic memberReverseClock
Reverse clock can be used for first-write-wins semantics. It's counting backwards, using min between -DateTime.UtcNow.Ticks and current timestamp - 1.
Top
Extension Methods
See Also