FIG_004 [ LOG ]
FIG_004 // Interactive Cutaway durability

DurabilityLog

Append-only partitioned log inside a Durable Object with independent cursors, contiguous leases, and cold tiering.

FIG_004 [ DURABILITY_LOG ] VERNIER // COLD-FIRST
1 Append (Dedupe) 2 Cursors / Lease 3 Trim → Cold Segment
1 / 5
READY (#96..#103): Consumer A committed at #102 while Consumer B reads independently at #98. Try out-of-order lease acks, cold-first trim, or click Consumer B / Cold Canisters to replay.
1. WRITE COLD 0 ALARMS EXPLICIT TRIM() DATA IN // LOG.APPEND() KEYWAY READY SQLITE DEDUPE KEYS k101 • k102 • k103 0 DUPE OFFSETS SEG #64-79 SEALED ✓ IMMUTABLE SEG #80-95 SEALED ✓ IMMUTABLE COLD LOCATOR 2 SEGS • ≤ #95 WRITE COLD FIRST LEASE() • CONTIGUOUS CALIPER SETTLED ✓ SPAN: #100..#102 EXCL BATCH OWNERSHIP FENCE: #102 ✓ ADVANCES CONTIGUOUSLY #96 HOT k96 #97 HOT k97 #98 HOT k98 #99 HOT k99 #100 HOT k100 #101 HOT k101 #102 HOT k102 #103 HOT k103 FENCE CONSUMER A COMMIT #102 READS AHEAD CONSUMER B COMMIT #98 OWN PACE COLD REPLAY: STANDBY durability_log_records HOT #96..#103 (8 RECS) MONOTONIC OFFSETS • DEDUPE KEYS RETAINED IN SQLITE 0 ALARMS EXPLICIT TRIM() COLD VAULT IMMUTABLE SEGS WRITE FIRST THEN TRIM HOT COLD REPLAY READS TRIMMED LEASE CLAMP CONTIGUOUS ONLY CONSUMER A INDEP VERNIER DEDUPE KEYWAY LOG.APPEND() CONSUMER B OWN PACE / COLD
GUARANTEE: WRITE COLD FIRST, THEN TRIM HOT • CONTIGUOUS CURSOR ADVANCEMENT • 0 ALARMS
SPEC // 04 [ ARCHITECTURE ]
01 // What it’s for

Why reach for DurabilityLog

Use DurabilityLog when multiple independent consumers need their own offset positions, ordered replay, or parallel batch leasing over a partition's history—without provisioning Kafka or an external streaming cluster.


02 // How it works

Inside your Durable Object

  1. 01Deduplicated offset rail: append() assigns strictly monotonic offsets in ctx.storage.sql and deduplicates retried writes by optional key.
  2. 02Independent consumer cursors: Each named consumer tracks and commits its own offset cursor independently without slowing down or affecting other readers.
  3. 03Contiguous lease fencing: Parallel workers can lease() non-overlapping ranges; the committed high-water cursor advances contiguously and refuses to leap over an unsettled gap.
  4. 04Cold-first explicit retention: The log sets zero automatic alarms—when your code calls trim(), hot records flush safely to your optional cold.write store before SQLite deletion, remaining transparently readable via cold.read.
Storage
SQLite + Optional Cold Store
Alarm
None (explicit trim())
Import
durability