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

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

Link to this section 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.

Check to see if any steps are completed, and if so handle them.

Link to this section 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()}

Check to see if any steps are completed, and if so handle them.

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.