Package kalix.javasdk.replicatedentity
Interface ReplicatedRegister<T>
- Type Parameters:
T
-
- All Superinterfaces:
kalix.replicatedentity.ReplicatedData
public interface ReplicatedRegister<T>
extends kalix.replicatedentity.ReplicatedData
A Last-Write-Wins Register.
This uses a clock value to determine which of two concurrent writes should win. When both clock values are the same, an ordering defined over the node addresses is used to break the tie.
By default, the clock used is the clock of the node that set the value. This can be affected by clock skew, which means two successive writes delegated to two separate nodes could result in the first one winning. This can be avoided by using a custom clock with a domain specific clock value, if such a causally ordered value is available.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Clock for register replication -
Method Summary
Modifier and TypeMethodDescriptionget()
Get the current value of the register.default ReplicatedRegister<T>
Set the value of the register, using the default clock.set
(T value, ReplicatedRegister.Clock clock, long customClockValue) Set the current value of the register, using the given custom clock and clock value if required.
-
Method Details
-
get
T get()Get the current value of the register.- Returns:
- the current value of the register
-
set
Set the value of the register, using the default clock.- Parameters:
value
- the new value of the register- Returns:
- a new register with updated value
-
set
Set the current value of the register, using the given custom clock and clock value if required.- Parameters:
value
- the new value of the registerclock
- the clock to use for replicationcustomClockValue
- the custom clock value to use, only if it's a custom clock- Returns:
- a new register with updated value
-