Expand description
Event-log writer task: dedicated consumer of EventLogEntry values
the reducer-task applier emits, persisting them to SQLite outside the
reducer’s critical section.
The applier hands entries to this task via EventLogTx. The reducer
never touches Db::event_log() directly — that keeps the reducer task
free of the SQLite Mutex during high-frequency RemoteAppendEventLog /
RecordTransition effects, and isolates writer hiccups (disk fsync
pauses, mutex contention) from the per-host step() path.
Backpressure: the channel is bounded. When full, the applier’s
send().await waits — which surfaces the slowdown back into the
reducer’s input MPSC, preserving the no-fail-open contract for the
audit log (RFC-0005 §6: every gate decision and state transition
must reach the log; silently dropping is forbidden).
Constants§
- EVENT_
LOG_ CHANNEL_ CAPACITY - Bounded channel depth for event-log entries between the reducer applier and the writer task.
Functions§
- drain_
pending 🔒 - Best-effort drain of in-flight entries on shutdown. Skips
send().awaitbecause we’re past the cancellation point — no new entries can arrive (every applier holds aSenderthat’s already been dropped or is about to be). - spawn
- Spawn the writer task. Returns the
JoinHandlefor the runtime drain.