Reactor.Builder.Recurse (reactor v0.15.6)
View SourceHandle recursive execution of Reactors for the builder.
This module provides functionality to recursively execute a reactor, with the output of each iteration becoming the input of the next one.
You should not use this module directly, but instead use
Reactor.Builder.recurse/4
.
Summary
Functions
Execute a Reactor recursively.
Verify that the reactor has compatible inputs and outputs for recursion.
Functions
@spec recurse( Reactor.t(), atom(), Reactor.t() | module(), [Reactor.Builder.step_argument()], keyword() ) :: {:ok, Reactor.t()} | {:error, any()}
Execute a Reactor recursively.
Options
:guards
(list of value that implements theReactor.Guard.Build
protocol) - Any guards which need to be added to the generated step The default value is[]
.:async?
(boolean/0
) - Whether the nested Reactor is allowed to run async or not The default value istrue
.:max_iterations
(pos_integer/0
) - Maximum number of iterations to execute:exit_condition
- Function to determine when to stop iteration
@spec verify_io_compatibility(Reactor.t() | module()) :: :ok | {:error, {:incompatible_io, String.t()}}
Verify that the reactor has compatible inputs and outputs for recursion.
For recursion to work properly, the output type of the reactor must match its input type, so that the result of one iteration can be fed into the next.
This function checks:
- The reactor has a return value defined
- The output structure (as a map) contains all keys that are required as inputs