Reactor.Executor.Hooks (reactor v0.12.1)

View Source

Handles the execution of reactor middleware hooks.

Summary

Functions

Run the completion hooks allowing the result to be replaced

Run the error hooks allowing the error to be replaced

Run any get_process_context hooks

Run the halt hooks collecting the new context as it goes

Run the init hooks collecting the new context as it goes

Run set_process_context hooks given the result of get_process_contexts/1

Functions

complete(reactor, result, context)

@spec complete(Reactor.t(), any(), Reactor.context()) ::
  {:ok, any()} | {:error, any()}

Run the completion hooks allowing the result to be replaced

error(reactor, reason, context)

@spec error(Reactor.t(), any(), Reactor.context()) :: {:error, any()}

Run the error hooks allowing the error to be replaced

event(reactor, event, step, context)

Emit a step event.

get_process_contexts(reactor)

@spec get_process_contexts(Reactor.t()) :: %{
  optional(Reactor.Middleware.t()) => any()
}

Run any get_process_context hooks

halt(reactor, context)

@spec halt(Reactor.t(), Reactor.context()) ::
  {:ok, Reactor.context()} | {:error, any()}

Run the halt hooks collecting the new context as it goes

init(reactor, context)

@spec init(Reactor.t(), Reactor.context()) ::
  {:ok, Reactor.context()} | {:error, any()}

Run the init hooks collecting the new context as it goes

set_process_contexts(contexts)

@spec set_process_contexts(%{optional(Reactor.Middleware.t()) => any()}) :: :ok

Run set_process_context hooks given the result of get_process_contexts/1