Enum LWWRegister.Clock
- java.lang.Object
-
- java.lang.Enum<LWWRegister.Clock>
-
- io.cloudstate.javasupport.crdt.LWWRegister.Clock
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<LWWRegister.Clock>
- Enclosing interface:
- LWWRegister<T>
public static enum LWWRegister.Clock extends java.lang.Enum<LWWRegister.Clock>
A clock.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CUSTOMA custom clock.CUSTOM_AUTO_INCREMENTA custom clock, that automatically increments the custom value if the local clock value is greater than it.DEFAULTThe default clock, uses the current system time as the clock value.REVERSEA reverse clock, based on the system clock.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static LWWRegister.ClockvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static LWWRegister.Clock[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
DEFAULT
public static final LWWRegister.Clock DEFAULT
The default clock, uses the current system time as the clock value.
-
REVERSE
public static final LWWRegister.Clock REVERSE
A reverse clock, based on the system clock.Using this effectively achieves First-Write-Wins semantics.
This is susceptible to the same clock skew problems as the default clock.
-
CUSTOM
public static final LWWRegister.Clock CUSTOM
A custom clock.The custom clock value is passed by using the
customClockValueparameter on theLWWRegister.set(Object, Clock, long)method. The value should be a domain specific monotonically increasing value. For example, if the source of the value for this register is a single device, that device may attach a sequence number to each update, that sequence number can be used to guarantee that the register will converge to the last update emitted by that device.
-
CUSTOM_AUTO_INCREMENT
public static final LWWRegister.Clock CUSTOM_AUTO_INCREMENT
A custom clock, that automatically increments the custom value if the local clock value is greater than it.This is like
CUSTOM, however if when performing the update in the proxy, it's found that the clock value of the register is greater than the specified clock value for the update, the proxy will instead use the current clock value of the register plus one.This can guarantee that updates done on the same node will be causally ordered (addressing problems caused by the system clock being adjusted), but will not guarantee causal ordering for updates on different nodes, since it's possible that an update on a different node has not yet been replicated to this node.
-
-
Method Detail
-
values
public static LWWRegister.Clock[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (LWWRegister.Clock c : LWWRegister.Clock.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LWWRegister.Clock valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
-