Skip to main content

Module pause

Module pause 

Source
Expand description

Durable operator pause/resume (#204): hold new activity dispatch while paused. Durable operator pause/resume (#204).

Pause holds NEW activity dispatch for a live, non-terminal run while keeping every durable record path alive (timer fires, signal receipts, drained completions). It is the Option-B “dispatch-hold” ruling of docs/PAUSE-RESUME-DESIGN.md §4: the resident process is NOT torn down; the hold lives at outbox claim time (see crate::lifecycle::pause::PausedRuns threaded into the outbox dispatcher), so a held row sits Pending — never Claimed — for the whole paused window, and release is purely resume plus the existing sweep.

§Single-writer discipline

Pause and resume of a RESIDENT run append through the live handle’s own recorder (the cancel precedent, terminate.rs), never a side-constructed Recorder::resume_at: a resident run’s handle already owns the single-writer recorder, and a second writer at the same head would desync the live recorder’s sequence tracker and hard-fail its next append (the exact hazard the surviving refutation identified). Only the crashed-while-paused resume path — where the run is NOT resident — builds one continuous Recorder::resume_at and hands it to the reopen respawn machinery.

§Naming

Named pause (not suspend/resume) to avoid colliding with transition.rs’s non-durable residency flip and the signal-router resume vocabulary, exactly as reopen avoided resume.

Structs§

PauseWorkflowContext
Dependencies required to pause or resume a workflow run.
PausedRuns
Shared, in-memory snapshot of the workflow ids whose outbox dispatch is held because the run is durably Paused (#204).

Functions§

pause
Pauses a live, Running run: appends WorkflowPaused through the resident handle’s own recorder (single-writer, cancel precedent) and inserts the run into the shared dispatch-hold set. The resident process is left alive.
resume
Resumes a Paused run: appends WorkflowResumed, releases the dispatch hold, and — when the run crashed while paused and is no longer resident — respawns it through the reopen recovery machinery, re-arming unfired timers.