View Source Duct.Parallel (duct v1.0.3)

Link to this section Summary

Functions

Returns an empty Duct.Parallel struct.

Adds a function to run parallel.

Returns the list of operations stored in multi.

Link to this section Types

@type name() :: any()
@type run() :: (() -> {:ok | :error, any()} | any())
@type t() :: %Duct.Parallel{names: names(), operations: operations()}

Link to this section Functions

@spec new() :: t()

Returns an empty Duct.Parallel struct.

example

Example

iex> Duct.Parallel.new() |> Duct.Parallel.to_list()
[]
@spec run(t(), name(), run()) :: t()

Adds a function to run parallel.

example

Example

Duct.Parallel.new()
|> Duct.Parallel.run("facebook", fn -> post(:facebook) end)
|> Duct.Parallel.run("twitter", fn -> post(:twitter) end)
|> Duct.run()
@spec to_list(t()) :: [{name(), term()}]

Returns the list of operations stored in multi.

Always use this function when you need to access the operations you have defined in Duct.Multi. Inspecting the Duct.Multi struct internals directly is discouraged.

Link to this function

yield_many(tasks, timeout \\ 5000)

View Source
@spec yield_many([t()], number() | :infinity) :: [
  {t(), {:ok, term()} | {:exit, term()} | nil}
]