Sync / foldkit-durable

makeJournal

const · packages/durable/src/node.ts:48

const makeJournal: <
  Operation,
  Snapshot,
  Principal,
  OperationEncoded = unknown,
  SnapshotEncoded = unknown,
>(
  options: JournalOptions<
    Operation,
    Snapshot,
    Principal,
    OperationEncoded,
    SnapshotEncoded
  >,
) => Effect.Effect<
  JournalShape<Operation, Snapshot, Principal, OperationEncoded>,
  JournalError | UnsupportedJournalVersionError,
  Scope
>

Opens a durable, ordered operation log with a snapshot and cursor per key.

Append is atomic and idempotent by opId; committed order is stable; the snapshot and cursor are consistent; and compaction drops payloads without changing what a replay of the compacted prefix would produce. The journal understands storage and ordering, never application semantics: reduce is the application's own transition function. The SQLite connection is released when the effect's scope closes.