aion/workflow/concurrency

Typed workflow concurrency combinators over homogeneous activity lists.

Values

pub fn all(
  activities: List(activity.Activity(i, o)),
) -> Result(List(o), error.ActivityError)

Spawn all activities concurrently and collect their typed outputs in input order.

Activity inputs are encoded with each activity’s input Codec; returned payloads are decoded one-by-one with the homogeneous output Codec. AT owns selective receive, fail-fast behaviour, correlation, and cancellation of remaining activities when any activity fails.

pub fn map(
  items: List(a),
  to_activity: fn(a) -> activity.Activity(i, o),
) -> Result(List(o), error.ActivityError)

Dynamically produce one activity per input element, then collect like all.

The v1 concurrency surface intentionally covers homogeneous-output list fan-out. Typed tuple variants such as all2/all3 are deferred additions.

pub fn race(
  activities: List(activity.Activity(i, o)),
) -> Result(o, error.ActivityError)

Race activities and return the first settled typed result.

This is FIRST SETTLE semantics, not first-success-wins: the first activity to finish wins whether it completes successfully or returns an ActivityError. AT records that winner and cancels the losers.

Search Document