Typed sub-state for tracking FanOut branch execution.
Replaces the bare map pending_fan_out in Workflow Strategy.
Encapsulates branch completion, suspension, queueing, and merge logic.
Summary
Functions
Record a successful branch completion.
Record a branch error (for :collect_partial mode).
Record a branch suspension.
Returns the completion status of the fan-out.
Merges branch results using the specified merge strategy.
Drain queued branches into available slots.
Returns {updated_state, to_dispatch} where to_dispatch is a list of
{branch_name, directive} tuples.
Find a suspended branch by suspension_id.
Check if a suspended branch matches the given suspension_id.
Merge completed results using the configured merge strategy.
Creates a new FanOut.State from dispatched and queued branches.
Resume a suspended branch by removing it from suspended_branches.
Types
@type t() :: %Jido.Composer.FanOut.State{ completed_results: %{required(atom()) => term()}, id: String.t(), merge: atom(), node: struct(), on_error: :fail_fast | :collect_partial, pending_branches: MapSet.t(), queued_branches: [{atom(), term()}], suspended_branches: %{ required(atom()) => %{ suspension: Jido.Composer.Suspension.t(), partial_result: term() } }, total_branches: non_neg_integer() | nil }
Functions
Record a successful branch completion.
Record a branch error (for :collect_partial mode).
@spec branch_suspended(t(), atom(), Jido.Composer.Suspension.t(), term()) :: t()
Record a branch suspension.
@spec completion_status(t()) :: :all_done | :suspended | :in_progress
Returns the completion status of the fan-out.
Merges branch results using the specified merge strategy.
Accepts either a map (from strategy tracking) or a keyword list
(from inline FanOutNode.run/3).
Drain queued branches into available slots.
Returns {updated_state, to_dispatch} where to_dispatch is a list of
{branch_name, directive} tuples.
Find a suspended branch by suspension_id.
Check if a suspended branch matches the given suspension_id.
Merge completed results using the configured merge strategy.
Creates a new FanOut.State from dispatched and queued branches.
Resume a suspended branch by removing it from suspended_branches.