View Source Shifts.Shift behaviour (Shifts v0.0.2)

TODO

Summary

Types

@type chore_fun() :: (Shifts.ShiftResult.outputs() -> Shifts.Chore.t())
@type operation() ::
  {:task, Shifts.Chore.t() | chore_fun()}
  | {:each, [t()]}
  | {:each_async, [t()]}
  | {:run, run_fun()}
@type operation_name() :: atom()
@type run_fun() :: (Shifts.ShiftResult.outputs() -> term())
@type t() :: %Shifts.Shift{
  operations: [{operation_name(), operation()}],
  workers: %{optional(worker_name()) => Shifts.Worker.t()}
}

TODO

@type worker_name() :: atom()

Callbacks

@callback init(shift :: t(), opts :: keyword()) :: t()

TODO

@callback work(shift :: t(), input :: term()) :: t()

TODO

Functions

Link to this function

each(shift, name, enum, callback)

View Source
@spec each(t(), operation_name(), Enumerable.t(), (t(), term() -> t())) :: t()

TODO

Link to this function

each_async(shift, name, enum, callback)

View Source
@spec each_async(t(), operation_name(), Enumerable.t(), (t(), term() -> t())) :: t()

TODO

Link to this function

run(shift, name, run_fun)

View Source
@spec run(t(), operation_name(), run_fun()) :: t()

TODO

Link to this function

task(shift, name, chore)

View Source
@spec task(t(), operation_name(), Shifts.Chore.t() | keyword() | chore_fun()) :: t()

TODO

Link to this macro

worker(name, opts \\ [])

View Source (macro)
@spec worker(
  worker_name(),
  keyword()
) :: Macro.t()

TODO