View Source Reactor.Executor.Async (reactor v0.10.2)

Handle the asynchronous execution of a batch of steps, along with any mutations to the reactor or execution state.

Summary

Functions

When the Reactor needs to shut down for any reason, we need to await all the currently running asynchronous steps and delete any task vertices.

Handle zero or one completed async steps and then decide what to do.

Functions

Link to this function

collect_remaining_tasks_for_shutdown(reactor, state)

View Source
@spec collect_remaining_tasks_for_shutdown(Reactor.t(), Reactor.Executor.State.t()) ::
  {Reactor.t(), Reactor.Executor.State.t()}

When the Reactor needs to shut down for any reason, we need to await all the currently running asynchronous steps and delete any task vertices.

Link to this function

handle_completed_steps(reactor, state)

View Source
@spec handle_completed_steps(Reactor.t(), Reactor.Executor.State.t()) ::
  {:recurse | :continue | :undo | :halt, Reactor.t(),
   Reactor.Executor.State.t()}

Handle zero or one completed async steps and then decide what to do.

Link to this function

start_steps(reactor, state, steps, supervisor \\ {:via, PartitionSupervisor, {Reactor.TaskSupervisor, self()}})

View Source
@spec start_steps(
  Reactor.t(),
  Reactor.Executor.State.t(),
  [Reactor.Step.t()],
  Supervisor.supervisor()
) ::
  {:continue | :recurse, Reactor.t(), Reactor.Executor.State.t()}
  | {:error, any()}

Start as many of the provided steps as possible.

Takes into account he maximum concurrency and available work slots.