Skip to main content

Module journal

Module journal 

Source
Expand description

Change journal of a project’s knowledge.

Every save of the store appends one row per fact it added, changed or removed, numbered by a log sequence number (LSN) that only grows. A reader asks “what changed since LSN n” instead of reloading and diffing the whole store, and a session can be shown the facts it touched.

Rows carry the fact’s identity (category, key with secrets redacted, creation time), the names of the fields that changed and the writing session, never a value: the store holds the values, and a row is shown with its key only while that fact is visible in the reader’s admitted view (ctx_knowledge changes). Local only; nothing is sent anywhere.

The journal sits beside knowledge.json and is written under the same project lock as the store, so its order is the order of the saves. It keeps the newest rows within MAX_JOURNAL_BYTES; LSNs continue across a trim.

Structs§

Change
A change before it is numbered.
JournalRow
One journaled change of one fact.

Functions§

diff
The changes from before to after, in identity order.
head_lsn
The newest LSN, 0 for an empty or missing journal.
rows_since
The rows after since, oldest first, at most limit.