Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0006-bridge-mirrored FR-006
The ledgers of a mirror, kept on its primary: one document for each replica, in a collection of typed documents below a reserved prefix, so that what each replica was last brought to is in the place that is authoritative and not in the memory of a process. A ledger is written at the version of its schema and read at any version up to it; a document that cannot be read is a problem and never an empty ledger, because an empty ledger would make every change of the replica look like a divergence of its own.
type LedgerBook = {
/** The ledger of a replica: an empty one where there is none, and a problem where one is there an…(688 characters)
typeLedgerBook= {
/** The ledger of a replica: an empty one where there is none, and a problem where one is there and cannot be read. */load(replica:DocId):Promise<Result<Ledger, LedgerProblem>>;
save(replica:DocId, ledger:Ledger):Promise<Result<void, LedgerProblem>>;
/** Saves several ledgers: as one batch where the primary has one (one commit of a branch, not one for each), else one after the other. */saveMany(entries:readonly { readonlyreplica:DocId; readonlyledger:Ledger }[]):Promise<Result<void, LedgerProblem>>;
/** Takes the ledger of a replica away, where it can be; what cannot be taken away is left. */remove(replica:DocId):Promise<void>;
};