Sync / foldkit-durable

Limits

  • SQLite only: via @effect/sql-sqlite-node (Node 22) in Journal.make, or any Effect SQLite client (@effect/sql-sqlite-wasm, @effect/sql-d1 with d1: true) in foldkit-durable/core.
  • In-transaction callbacks: reduce, validate, authorize, and judge hold the write lock; keep them pure, fast, and free of services.
  • Single-writer deployment: database constraints enforce uniqueness of [key, op_id] and [key, sequence], while one authoritative writer per file avoids lock contention.
  • Pre-schema-3 compaction: payloads compacted before schema 3 lack canonical hashes, so key-reordered retries of those rows cannot be matched by hash.
  • Application-driven recovery: recover runs when your host schedules it rather than spawning a background worker.

Older spellings

makeJournal, makeJournalLayer, and journalMetrics map to Journal.make, Journal.layer, and Journal.metrics; documentId, opId, actorId, sequence, and cursor map to .make constructors. Prefer Journal.define over JournalService(key) so generic parameters stay tied to the layer. Plain { encode, decode } function pairs work anywhere Schema.Codec is accepted.

Next