aion/child

Typed child-workflow handles and await wrappers.

Types

A typed handle for a linked child-workflow execution.

output and workflow_error are the child workflow’s statically-known result and error types. The handle carries the engine correlation id plus the codecs required to decode the recorded child completion or failure payload returned by AT/AD.

pub opaque type ChildHandle(output, workflow_error)

Values

pub fn await(
  handle: ChildHandle(output, workflow_error),
) -> Result(output, error.ChildError(workflow_error))

Await a child workflow’s recorded completion or failure.

AT/AD own blocking, replay resolution, and event recording. This wrapper decodes the raw recorded envelope with the codecs carried on the handle and returns decode/engine failures as typed data.

The await is a yield point: pending workflow queries are serviced by the query pump before the child terminal resolves, exactly as activity awaits, signal receives, and timers do. Without the pump, a query arriving while the workflow is parked here would surface its sentinel as a bogus child failure and leave the engine refusing every later await in the run.

pub fn child_id(
  handle: ChildHandle(output, workflow_error),
) -> String

Return the engine child/correlation id carried by this handle.

pub fn error_codec(
  handle: ChildHandle(output, workflow_error),
) -> codec.Codec(workflow_error)

Return the workflow-error codec carried by this child handle.

pub fn output_codec(
  handle: ChildHandle(output, workflow_error),
) -> codec.Codec(output)

Return the output codec carried by this child handle.

pub fn spawn(
  name: String,
  workflow_fn: fn(input) -> Result(output, workflow_error),
  input: input,
  input_codec: codec.Codec(input),
  output_codec: codec.Codec(output),
  error_codec: codec.Codec(workflow_error),
) -> Result(
  ChildHandle(output, workflow_error),
  error.EngineError,
)

Start a linked child workflow and return its typed handle.

The workflow_fn is accepted as a type anchor for the child workflow’s fn(input) -> Result(output, workflow_error) contract. The SDK does not call it here; lifecycle, linking, recording, and replay/no-respawn behavior are owned by AT/AD behind the FFI boundary.

pub fn spawn_and_wait(
  name: String,
  workflow_fn: fn(input) -> Result(output, workflow_error),
  input: input,
  input_codec: codec.Codec(input),
  output_codec: codec.Codec(output),
  error_codec: codec.Codec(workflow_error),
) -> Result(output, error.ChildError(workflow_error))

Start a linked child workflow and await its recorded result.

This is the spawn-then-await convenience kept in the child logic module so aion/workflow can remain a forwarding authoring surface.

Search Document