SimpleEnvironment

open class SimpleEnvironment(uid: ClientUId) : Environment

A simple environment generating increasing monotonic timestamps

For simplicity, it also:

  • Provides access to the last submitted delta

  • Automatically updates itself on merge operations to ensure a generated timestamp is always greater than any known timestamp

Constructors

SimpleEnvironment
Link copied to clipboard
common
fun SimpleEnvironment(uid: ClientUId)

Functions

equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
getState
Link copied to clipboard
common
open override fun getState(): VersionVector
Gets the state associated with the environment.
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
onMerge
Link copied to clipboard
common
open override fun onMerge(obj: DeltaCRDT, delta: DeltaCRDT, lastTs: Timestamp?)
Hook method called by CRDTs on every mergeNote: a merge is not considered as an operation and MUST NOT trigger onWrite.
onRead
Link copied to clipboard
common
open fun onRead(obj: DeltaCRDT)
Hook method called by CRDTs on every read operationNote: a delta generation is not considered as an operation and MUST NOT trigger onRead.
onWrite
Link copied to clipboard
common
open override fun onWrite(obj: DeltaCRDT, delta: DeltaCRDT)
Hook method called by CRDTs on every write operationNote: a merge is not considered as an operation, and MUST trigger onMerge instead.
popWrite
Link copied to clipboard
common
fun popWrite(): Pair<DeltaCRDT, DeltaCRDT>
Pop (return and delete) the last delta submitted via onWrite() Throws NullPointerException if last submitted delta has already been pop()ed.
tick
Link copied to clipboard
common
open override fun tick(): Timestamp
Generates a monotonically increasing timestamp.
toString
Link copied to clipboard
common
open fun toString(): String
update
Link copied to clipboard
common
open override fun update(ts: Timestamp)
Updates the state with the given timestamp.
open override fun update(vv: VersionVector)
Updates the state with the given version vector.

Properties

uid
Link copied to clipboard
common
val uid: ClientUId
The client uid linked to this environment.