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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new InMemoryAuthority(origin?): InMemoryAuthority;Defined in: collab-transport.ts:150
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
origin | DocumentNode |
Returns
Section titled “Returns”InMemoryAuthority
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get doc(): DocumentNode;Defined in: collab-transport.ts:161
The canonical document. Every peer’s confirmed doc equals this at head.
Returns
Section titled “Returns”DocumentNode
Get Signature
Section titled “Get Signature”get head(): number;Defined in: collab-transport.ts:156
Number of canonical records — the version every confirmed peer converges to.
Returns
Section titled “Returns”number
originDoc
Section titled “originDoc”Get Signature
Section titled “Get Signature”get originDoc(): DocumentNode;Defined in: collab-transport.ts:171
The starting document every peer must initialize from to replay the log.
Returns
Section titled “Returns”DocumentNode
records
Section titled “records”Get Signature
Section titled “Get Signature”get records(): LedgerRecord[];Defined in: collab-transport.ts:166
A snapshot copy of the canonical log.
Returns
Section titled “Returns”LedgerRecord[]
Methods
Section titled “Methods”since()
Section titled “since()”since(order): LedgerRecord[];Defined in: collab-transport.ts:180
Canonical records at or after order — the payload for delta sync / late join.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
order | number |
Returns
Section titled “Returns”LedgerRecord[]
submit()
Section titled “submit()”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.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
base | number |
records | readonly LedgerRecord[] |
Returns
Section titled “Returns”versionVector()
Section titled “versionVector()”versionVector(): VersionVector;Defined in: collab-transport.ts:175