Custodian v0.0.1 Custodian.Tasks behaviour View Source

Behaviour interface for processing tasks.

Tasks are encapsulated segments of work that need to be done. They can be processed in the background by spawning a new process or synchronously by running inline.

Link to this section Summary

Types

Tuple containing an atom indicating successful startup and the PID of the process running the test. Otherwise, returns an error tuple

Functions

Runs the given function as a task

Callbacks

Takes a function and runs the task according to the implementation. Returns a success or error tuple

Link to this section Types

Link to this type result() View Source
result() :: {:ok, pid()} | any()

Tuple containing an atom indicating successful startup and the PID of the process running the test. Otherwise, returns an error tuple.

Link to this section Functions

Link to this function process(fun) View Source
process((() -> any())) :: result()

Runs the given function as a task

This runs fun as a task according to the configured processor. For most environments, this is asynchronous: a new process is spawned and supervised by the app. For some environments, like test, this is inline.

Link to this section Callbacks

Link to this callback process(fun) View Source
process(fun :: (() -> any())) :: result()

Takes a function and runs the task according to the implementation. Returns a success or error tuple.