Module sagas

Module sagas 

Source

Modules§

delete_block
delete_tab
delete_workspace
log
promote_block_to_tab
recovery
restore_torn_off_tab
tear_off_block
tear_off_tab

Structs§

SagaCtx
Read-only context passed to a saga’s inner async function. Wraps the AppState handle and the saga’s allocated id.

Enums§

SagaTerminal
Outcome a saga’s inner future hands back to emit_terminal.

Constants§

SAGA_TIMEOUT 🔒
Maximum wall-clock time a saga is allowed to run before the coordinator force-fails it. Tear-off sagas should complete in tens of milliseconds; the budget is generous to absorb SQLite write spikes without flapping in CI.

Functions§

alloc_saga_id
Allocate the next saga_id. Monotonic per srv-process run.
classify_run_saga_result
Convenience: classify the standard run_saga Result<Value, String> outcome into a SagaTerminal.
emit_saga_started
Emit Event::SagaStarted for a freshly-allocated saga_id. Sagas call this immediately after alloc_saga_id so subscribers see the start record before any per-step events.
emit_terminal
Emit the saga’s terminal lifecycle event + durable log row.
run_saga
Run a saga’s inner future under a 5 s timeout. The inner future is responsible for emitting SagaStarted (the saga itself, since it owns the saga_id allocation) and any compensation it needs; run_saga only enforces the timeout and emits the terminal SagaCompleted / SagaFailed.