Squidie.Runtime.Journal.Commands.Cancellation (squidie v0.3.4)

Copy Markdown View Source

Journal-backed workflow cancellation.

Cancellation appends a terminal run fact to the run thread. Dispatch projections already overlay terminal run facts from run threads, so stale claims and later completions are fenced by the same durable source of truth. The configured queue selects the returned dispatch projection; cancellation itself is scoped by the globally unique run id.

Summary

Functions

Applies a normalized cancellation signal to the journal runtime.

Cancels a journal-backed workflow run.

Types

cancel_error()

@type cancel_error() ::
  :not_found
  | :invalid_run_id
  | {:invalid_option, term()}
  | {:invalid_transition, atom(), :cancelling}
  | term()

Functions

apply_signal(signal, opts)

@spec apply_signal(
  Squidie.Runtime.Signal.t(),
  keyword()
) ::
  {:ok, Squidie.ReadModel.Inspection.Snapshot.t()}
  | {:error, cancel_error() | {:invalid_signal, term()}}

Applies a normalized cancellation signal to the journal runtime.

cancel(run_id, opts \\ [])

@spec cancel(
  String.t(),
  keyword()
) :: {:ok, Squidie.ReadModel.Inspection.Snapshot.t()} | {:error, cancel_error()}

Cancels a journal-backed workflow run.