gizlang:journal
Shared log coordinates. Durable publication, retention and product events remain with their storage owners; no database or wire adapter is imported.
import * as Journal from "gizlang:journal";Types
Position
type Position = { shard: string; history: string; sequence: i64; operation: i64; }A place in a journal: its shard, its history, the sequence of the commit and the operation within it.
shard:stringhistory:stringsequence:i64operation:i64
Acknowledgement
type Acknowledgement = { floor: i64; observed: Position; }Explicit acceptance of terminal outcomes through a request floor and cut. Product owners retain pending intents and decide what is safely collectible.
floor:i64observed:gizlang_journal.Position
Functions
validAcknowledgement
function validAcknowledgement(acknowledgement: Acknowledgement, history: string, maximumCut: i64): boolWhether ACKNOWLEDGEMENT is valid for HISTORY: it observes the end of a commit of HISTORY at most MAXIMUMCUT.
boundary
function boundary(history: string, sequence: i64): PositionThe position at the end of commit SEQUENCE of HISTORY.
compare
function compare(a: Position, b: Position): i64 throws stringHistories are incomparable; a new history requires a snapshot.
Effects: fail.
cursor
function cursor(position: Position): stringExact coordinates encoded in an opaque, URL-safe, checksummed envelope.
Effects: fail.
readCursor
function readCursor(text: string): Position throws stringThe position that text spells (the form cursor writes), or why it is not one.
Effects: fail.
retained
function retained(position: Position, history: string, first: i64, last: i64): boolWhether POSITION is in HISTORY and in the commits FIRST to LAST that the journal keeps.
Effects: fail.
Constants
COMMIT_END
const COMMIT_END = 9223372036854775807The position that no commit reaches: the open end of a range.
SHARD
const SHARD = "local"The name of the shard of a local journal.