March Docs

Conduit.WorkflowContext

Functions

fncheckpointcheckpoint(storage : s, ctx : Conduit.WorkflowContext, name : String, f) : Result(String, WorkflowError)#

Execute a durable checkpoint.

  1. Check in-memory Vault cache for namespace ++ name.
  2. If cached: return immediately — fn is NOT called.
  3. Check DB: conduit_checkpoints for (workflow_id, full_name).
  4. If found in DB: populate cache and return.
  5. Otherwise: call fn(), record duration, persist to DB, cache, return.
`f` must return a String (typically JSON-serialized). The return value
is the stored string on success or a WorkflowError on failure.
fnchildchild(ctx : Conduit.WorkflowContext, branch_prefix : String) : Conduit.WorkflowContext#

Create a sub-context for a parallel branch (namespaced checkpoints).

fnnewnew(workflow_id : String) : Conduit.WorkflowContext#

Create a root context for a new or resuming workflow execution.

fnparallelparallel(storage : s, ctx : Conduit.WorkflowContext, items : List(a), f)#

Fan-out over a list of items, each with its own checkpoint sub-namespace.

Each item gets a child context `"parallel:N:"` so its checkpoints are
isolated and resumable independently. Execution is sequential in Phase 4.

`f` takes (item, sub_ctx) and returns Result(String, WorkflowError).
Returns Ok(List(String)) with results in order, or Err on first failure.
fnwait_for_signalwait_for_signal(storage : s, ctx : Conduit.WorkflowContext, signal_type : String, timeout : Option(Duration))#

Wait for a signal of signal_type to arrive for this workflow.

Checks the DB immediately for a pending/undelivered signal. If found,
marks it delivered and returns its payload. If not found, polls every
second until a signal arrives or the timeout fires.

Returns Ok(payload_json) or Err(WorkflowError.TimedOut).
fnwarm_cachewarm_cache(storage : s, ctx : Conduit.WorkflowContext) : Result((), String)#

Load all checkpoints for this workflow from the DB into Vault. Call this once before run() to avoid redundant DB lookups during execution.