parseDeltafunctionno test imports itfunction parseDelta(x: unknown, limits: Limits): Result<Delta, string>A delta from what was read of its text, or why it is not one: the shape of the format and nothing else, within the limits.
The delta and what is done with it. A delta is read from text by parseDelta, which accepts only what the format says and refuses what is too large, and is then judged by applyDelta: whom it is from (the trust), when it is from (an id too far ahead is refused), whether each row is its own checksum and each blob the hash of its bytes, and whether this replica holds what the rows replace and the blobs the puts name (until it does, the delta waits). A delta that is judged is added in one step, so that its rows come all together or not at all, and a delta applied twice has the effect of once. A row that has the id of a row held but another sum is not refused: both are kept, and the finding says so.
import { deltaId } from "./delta.ts";parseDeltafunctionno test imports itfunction parseDelta(x: unknown, limits: Limits): Result<Delta, string>A delta from what was read of its text, or why it is not one: the shape of the format and nothing else, within the limits.
deltaTextfunctionno test imports itfunction deltaText(delta: Delta): stringThe text of a delta with its rows and blobs in order, no space and the signature left out: what its identity is made of.
encodeDeltafunctionfunction encodeDelta(delta: Delta): stringThe text of a delta as it is kept in a store: the same text, and the signature where it has one.
decodeDeltafunctionfunction decodeDelta(text: string, limits: Limits): Result<Delta, string>A delta from its text, or why it is not one.
deltaIdfunctionfunction deltaId(delta: Delta): Promise<string>The identity of a delta: the SHA-256 of its text without its signature.
deltaSincefunctionfunction deltaSince(state: MergeState, since: VersionVector): DeltaThe delta of what a replica holds that a replica holding since does not: the rows whose number is past what since holds of their replica, and the blobs their puts name.
trustRefusalfunctionno test imports itfunction trustRefusal(trust: Trust, delta: Delta): Promise<MergeRefusal | undefined>What a trust says of a delta before anything else is looked at: the replicas it names must be ones that are taken from, and under signed trust the delta must be signed by a key of its origin that was valid when its newest row was made. undefined where the trust takes the delta. A bridge holds a trust of its own and asks the same question, so that what a medium offers is judged by the owner of the command as well as by the replica.
Appliedtypeno test imports ittype Applied = Step;What taking a delta made of a replica, and what it ended with.
applyDeltafunctionfunction applyDelta(state: MergeState, delta: Delta, wall: number): Promise<Step>Takes a delta into a replica. Where the delta is applied the deltas the replica held back are tried again, for what this one brought may be what they waited for. Where it is not applied the state is the state the replica had, except that a delta that has to wait is kept.
verifyStatefunctionfunction verifyState(state: MergeState, wall: number): Promise<readonly MergeFinding[]>What is wrong with the rows and blobs a replica holds, whatever way they came: a row that is not its checksum, an id that is not an id, a row from a replica the trust does not name, an id from the far future, an id on two rows, a number twice, a parent or a blob that is not there, bytes that are not the hash they are named by. This is the check of a replica whose rows were put there by a SQL import, which no trust check of ours stood in front of.
reportOfconstno test imports itconst reportOf: (state: MergeState) => VersionVectorThe version vector a replica reports.