IF Commons GitHub

governance/revision

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0002-anyfs-governance FR-003

The revision of an object and the cursor of a list, each a branded text made only by its parser. A revision is scheme:value: the scheme says what the value is (sha256 the digest of the bytes, etag an entity tag, git an object id, ver a version a service gave), and two revisions are equal when their texts are, so that a write which expects one can be decided by any backend.

import { parseRevision, schemeOf } from "./revision.ts";
const r = parseRevision("sha256:ab12");
r.kind === "ok" && schemeOf(r.value); // "sha256"

Source: commons/anyfs/src/governance/revision.ts

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

Revisiontypeno test imports it
type Revision = Brand<string, "anyfs revision">;

The identity of one state of an object: scheme:value. Made only by parseRevision.

Cursortypeno test imports it
type Cursor = Brand<string, "anyfs cursor">;

Where a list resumes: opaque to the caller. Made only by parseCursor.

parseRevisionfunction
function parseRevision(text: string): Result<Revision, string>

A revision from text, or the reason it is not one: a lower case scheme, a colon and printable ASCII with no space, at most 256 characters.

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

parseCursorfunction
function parseCursor(text: string): Result<Cursor, string>

A cursor from text, or the reason it is not one: printable ASCII with no space, at most 1024 characters.

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

schemeOffunction
function schemeOf(revision: Revision): string

The scheme of a revision: what its value is.

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

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