C
VersionVector
testedTracks the highest clock seen per site, assuming each site emits dense clocks (1, 2, 3, …). Used to deduplicate ops and to compute deltas during sync.
Signature
ts
class VersionVectorMethods
observeRecord that an op has been seen.
ts
observe(id: OpId): void| Parameter | Type | Description |
|---|---|---|
id | OpId | — |
getHighest clock seen for a site (0 if none).
ts
get(site: SiteId): number| Parameter | Type | Description |
|---|---|---|
site | string | — |
Returns
numberhasWhether an op id has already been seen.
ts
has(id: OpId): boolean| Parameter | Type | Description |
|---|---|---|
id | OpId | — |
Returns
booleantoJSONPlain-object snapshot for transport.
ts
toJSON(): Record<SiteId, number>Returns
Record<string, number>fromJSONts
static fromJSON(snapshot: Record<SiteId, number>): VersionVector| Parameter | Type | Description |
|---|---|---|
snapshot | Record<string, number> | — |
Returns
VersionVectorclonets
clone(): VersionVectorReturns
VersionVector