Skip to main content

Module kernel_journal

Module kernel_journal 

Source
Expand description

KernelJournal — the durable transaction capability of the Canonical Kernel ABI (spec §9.1).

The Rust port of node/src/runtime/kernel-journal.ts, which is the authoritative interface shape for all four SDKs. Three rules give this module its shape:

  1. Records are opaque. core owns canonical serialization and hashing (KernelRecord::record_bytes() / record_digest() / expected_head()). The host stores the bytes verbatim and indexes them by the digest core handed it. A journal that re-serialised a record to recompute its hash would make “the host recomputed and disagreed” a reachable state; it is not one here.
  2. CAS is a storage-layer primitive, not a read-compare-write sequence. §9.1 requires a real atomic operation (file lock / atomic link publish / conditional database update). InMemoryKernelJournal is atomic only within one process and says so in its own type; FileKernelJournal is atomic across processes (see its type docs).
  3. The journal’s sequence space is step_seq — the operation’s record-chain position — and is completely independent of super::session_log::SessionLog’s business event seq. Pruning a journal prefix can never punch a hole in business event numbering (spec Task 8b, criterion 4). That is why this is a separate trait rather than more methods on SessionLog (§9.4): a custom business-projection log must never be forced to masquerade as a transactional journal. One type may implement both.

Failures are typed so a caller can tell “retry after rebuild” from “this storage is broken” from “someone handed me a corrupt chain” — a durable-step wrapper must never publish effects on any of them, and must never collapse them into one opaque error. See JournalError.

Structs§

CheckpointCandidate
The host-persistable part of kernel.checkpoint_candidate() (spec §12.3).
FileKernelJournal
Cross-process atomic reference implementation of KernelJournal (spec Task 8b).
InMemoryKernelJournal
Single-process dev/test implementation (spec Task 8b, criterion 2).
InstalledCheckpoint
An installed checkpoint. Flattens node’s InstalledCheckpoint extends CheckpointCandidate.
JournalAppendReceipt
JournalEntry
A stored record. previous_record_digest is the CAS precondition it was appended under.
JournalHead
The journal head: the last record of an operation’s chain.
JournalPruneReceipt
JournalRecordInput
What a host hands the journal: core’s opaque bytes plus the identity core assigned them.

Enums§

JournalError
Why a journal operation failed, split into the three classes a caller must treat differently.

Traits§

KernelJournal
The durable transaction capability (spec §9.1). Deliberately not part of super::session_log::SessionLog (§9.4).

Type Aliases§

JournalResult