IF Commons GitHub

merge/delta

Written to: 6 requirements: 6 proved, 0 partly, 0 failing, 0 with no test recorded. 0008-anyfs-merge-logical FR-010, 0008-anyfs-merge-logical FR-011, 0008-anyfs-merge-logical FR-012, 0008-anyfs-merge-logical FR-013, 0008-anyfs-merge-logical FR-014, 0008-anyfs-merge-logical FR-015

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";

Source: commons/anyfs/src/merge/delta.ts

6 of 11 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

parseDeltafunctionno test imports it
function 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 it
function deltaText(delta: Delta): string

The text of a delta with its rows and blobs in order, no space and the signature left out: what its identity is made of.

encodeDeltafunction
function encodeDelta(delta: Delta): string

The text of a delta as it is kept in a store: the same text, and the signature where it has one.

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

decodeDeltafunction
function decodeDelta(text: string, limits: Limits): Result<Delta, string>

A delta from its text, or why it is not one.

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

deltaIdfunction
function deltaId(delta: Delta): Promise<string>

The identity of a delta: the SHA-256 of its text without its signature.

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

deltaSincefunction
function deltaSince(state: MergeState, since: VersionVector): Delta

The 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.

Imported by 19 tests of the run (19 passed, 0 failed): the library's results

trustRefusalfunctionno test imports it
function 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 it
type Applied = Step;

What taking a delta made of a replica, and what it ended with.

applyDeltafunction
function 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.

Imported by 24 tests of the run (24 passed, 0 failed): the library's results

verifyStatefunction
function 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.

Imported by 14 tests of the run (14 passed, 0 failed): the library's results

reportOfconstno test imports it
const reportOf: (state: MergeState) => VersionVector

The version vector a replica reports.

Titles, headings, exports, tables, columns and requirements. Esc closes.