Skip to content

InMemoryAuthority

Defined in: collab-transport.ts:143

The single source of truth. Holds the canonical ordered log and the canonical document it folds to. submit is the linearization point: it rebases the incoming records over the gap the submitter had not yet seen, drops any that can no longer be placed unambiguously (canonical always wins — deterministic), assigns the next order, and returns the canonical records to broadcast.

new InMemoryAuthority(origin?): InMemoryAuthority;

Defined in: collab-transport.ts:150

ParameterType
originDocumentNode

InMemoryAuthority

get doc(): DocumentNode;

Defined in: collab-transport.ts:161

The canonical document. Every peer’s confirmed doc equals this at head.

DocumentNode


get head(): number;

Defined in: collab-transport.ts:156

Number of canonical records — the version every confirmed peer converges to.

number


get originDoc(): DocumentNode;

Defined in: collab-transport.ts:171

The starting document every peer must initialize from to replay the log.

DocumentNode


get records(): LedgerRecord[];

Defined in: collab-transport.ts:166

A snapshot copy of the canonical log.

LedgerRecord[]

since(order): LedgerRecord[];

Defined in: collab-transport.ts:180

Canonical records at or after order — the payload for delta sync / late join.

ParameterType
ordernumber

LedgerRecord[]


submit(base, records): SubmitResult;

Defined in: collab-transport.ts:193

Integrate a client’s submission. base is the canonical length the client had seen when it authored records; anything canonical after base is the concurrent “gap” the records are rebased over. Records whose id is already canonical are de-duplicated (skipped) so a re-submit can never double-apply. Note that a skipped record is reported in neither records nor dropped: the canonical confirm for it was already broadcast once, so a client that missed it must recover by re-sync()ing from its head, not by resubmitting.

ParameterType
basenumber
recordsreadonly LedgerRecord[]

SubmitResult


versionVector(): VersionVector;

Defined in: collab-transport.ts:175

VersionVector