C

LwwRegister

tested

Last-writer-wins register. A write applies only if its op id is later than the current write's (by compareOpId), so concurrent writes converge to the one with the higher timestamp regardless of arrival order.

Signature

ts
class LwwRegister<T>

Type Parameters

T

Properties

PropertyTypeDescription
timestampreadonlyOpId | null

Methods

get
ts
get(): T
ReturnsT
set

Apply a timestamped write. Returns true if it won.

ts
set(value: T, id: OpId): boolean
ParameterTypeDescription
valueT
idOpId
Returnsboolean