Module log

Module log 

Source
Expand description

The log engine — “the log is the database” (§5.3).

Phase 0 wrote this against one hand-written Event type. Phase 1 writes it against [beck_core::Value], because the event type now comes from the program: union Event in the source is what decides what a log record contains, and the runtime must not know its shape.

The contract every substrate keeps is unchanged, and is the thing all the determinism rests on:

  • seq is assigned here and nowhere else, densely, from a single writer (§3.7).
  • A batch of events from one command is appended atomically at contiguous seqs — no fold ever observes half a command’s consequences.
  • Reads are ordered and replayable from any position; that is what beck replay, (subscription, seq) resumption and forked worlds are made of.

We do not write a storage engine (docs/01-vision-and-premise.md §1.5). This is a small log engine on top of proven storage: redb for rung 0, PostgreSQL for everything above it.

Structs§

Envelope
The records a log is made of, defined in beck_host::record because a browser tab holds a log too and an envelope has to mean the same thing in both (docs/17 §17.2). What is here is the engine: the substrates, and the contract above. A durably logged occurrence. The fields are §3.7’s, and actor is a stable identity — never the live Session capability or a token (F5).
Instant
The records a log is made of, defined in beck_host::record because a browser tab holds a log too and an envelope has to mean the same thing in both (docs/17 §17.2). What is here is the engine: the substrates, and the contract above. Wall-clock instant, milliseconds since the Unix epoch, captured at ingress as data.
MemoryLog
Pending
The records a log is made of, defined in beck_host::record because a browser tab holds a log too and an envelope has to mean the same thing in both (docs/17 §17.2). What is here is the engine: the substrates, and the contract above. A validated event on its way to the log, before seq exists.
PgLog
RedbLog
Snapshot
The records a log is made of, defined in beck_host::record because a browser tab holds a log too and an envelope has to mean the same thing in both (docs/17 §17.2). What is here is the engine: the substrates, and the contract above. A snapshot of the durable fold: the accumulator plus the position it was taken at.
SqliteLog
A log in a single SQLite file.

Enums§

Durability
How much a commit promises, which is a semantic choice rather than a tuning knob.

Constants§

DDL
The DDL the compiler emits for a durable fold (§4.3 stage 4, “emit state artefacts”).
SQLITE_DDL
The same three tables, in SQLite’s dialect.

Traits§

LogStore

Type Aliases§

Seq
The records a log is made of, defined in beck_host::record because a browser tab holds a log too and an envelope has to mean the same thing in both (docs/17 §17.2). What is here is the engine: the substrates, and the contract above. Position in the total order. One totally-ordered log per application (§3.7 v1 semantics).