saga/reporting

Reporting for a short-lived task that owns a workflow execution. run_owned returns its full execution report while the task lives. If the task exits abnormally, the independent receiver waits for compensation and calls on_stopped with the same full-report result. The receiver monitors the task until it exits, even after returning a result: use this boundary inside a per-invocation worker, not a long-lived server process. rollback_within bounds waiting when the owner dies before reporting whether it started a coordinator; normal execution follows execution.Config. Receiver readiness has a five-second bound. A receiver that exits or misses that deadline produces a typed error with NotStarted effect status before the workflow starts. Its startup channel and monitor are discarded without consuming other mail. The notification callback runs in a guarded worker, bounded by the same rollback_within duration; a crash or timeout leaves delivery unconfirmed.

Types

What an operational error proves about workflow effects. Neither status grants permission to retry; the caller owns its business retry policy.

pub type EffectStatus {
  NotStarted
  Unknown
}

Constructors

  • NotStarted
  • Unknown

A failure to obtain an execution report. Workflow failures are retained in Ok(execution.Outcome), including their native business and undo errors.

pub opaque type Error

Stable operational categories; use the cause accessors for typed evidence.

pub type ErrorKind {
  InvalidRollback
  ReceiverStartupExited
  ReceiverStartupTimedOut
  ExecutionAdmission
  ReceiverLost
  CoordinatorLost
}

Constructors

  • InvalidRollback
  • ReceiverStartupExited
  • ReceiverStartupTimedOut
  • ExecutionAdmission
  • ReceiverLost
  • CoordinatorLost

Values

pub fn describe_error(error: Error) -> String

A safe description, excluding crash and application payloads.

pub fn effect_status(error: Error) -> EffectStatus
pub fn error_kind(error: Error) -> ErrorKind
pub fn exit_reason(
  error: Error,
) -> option.Option(process.ExitReason)

Available process exit evidence, unchanged. An abnormal reason may contain application data; use describe_error for a data-safe message.

pub fn invalid_rollback_within(
  error: Error,
) -> option.Option(duration.Duration)
pub fn run_error(
  error: Error,
) -> option.Option(execution.RunError)

The original execution-admission cause, including typed configuration errors or the execution’s crash evidence. Crash text can contain private data.

pub fn run_owned(
  workflow: saga.Workflow(input, output, error, undo_error),
  input: input,
  config: execution.Config,
  on_stopped: fn(
    Result(execution.Outcome(output, error, undo_error), Error),
  ) -> Nil,
  rollback_within: duration.Duration,
) -> Result(execution.Outcome(output, error, undo_error), Error)

Runs the workflow in the calling task, which owns the Saga run, and waits for its outcome through the receiver.

✨ Search Document