Interface IClock

A single logical clock. Session ID is a random identifier randomly assigned to each new editing session. (It could be called "actorId" or "clientId", but the same user can have multiple editing sessions, hence "sessionId" is better.)

The time component is a monotonically increasing integer, starting from 0. It does not produce gaps. The tick() method should be used to increment the time. When the time is incremented by multiple cycles, say 10, i.e. clock.tick(10), it means that the user has implicitly generated 10 logical timestamps, but only the first one is returned. This means that the user has 10 consecutive operations which they wish to identify by a single LogicalTimestamp for space saving purposes, but it is possible find the exact operation for each distinct implicit logical timestamp.

interface IClock {
    sid: number;
    time: number;
    tick(cycles): ITimestampStruct;
}

Hierarchy (view full)

Implemented by

Properties

Methods

Properties

sid: number

Session ID (or actor ID, site ID, process ID, etc.), a random identifier randomly assigned to each editing session.

time: number

Logical time (or sequence number, tick, etc.), a monotonically increasing integer, starting from 0. It does not produce gaps on local machine, but it can produce gaps when merged with other clocks.

Needs to be mutable in vector clock. Other than that, it should be treated as immutable.

Methods