Manic.Multi (Manic v0.1.1) View Source
Module for encapsulating multiple miner Merchant API clients.
Link to this section Summary
Functions
Sets the asynchronous operation on the given multi miner
client.
Sets the asynchronous operation on the given multi miner
client.
Returns a multi miner
client for the given list of
Merchant API endpoints.
Concurrently runs the asynchronous operation on the given multi miner
client, yielding the response from any or all of the miners.
Link to this section Types
Specs
result() :: {Manic.miner(), {:ok, any()}} | [{Manic.miner(), {:ok | :error, any()}}, ...]
Multi miner API response
Specs
t() :: %Manic.Multi{ miners: list(), operation: {atom(), atom(), list()} | function(), timeout: term(), yield: :any | :all }
Bitcoin multi miner API client
Link to this section Functions
Specs
Sets the asynchronous operation on the given multi miner
client.
The operation is an inline function which receives the miner
client.
Example
iex> Manic.Multi.async(multi, fn miner ->
...> MyModule.some_function(miner)
...> end)
Or, the same more succinctly:
iex> Manic.Multi.async(multi, &MyModule.some_function/1)
Specs
Sets the asynchronous operation on the given multi miner
client.
The operation is passed as a tuple containing the module, function name and
list or arguments. In this case, the miner
client will
automatically be prepended to the list of arguments.
Example
iex> Manic.Multi.async(multi, MyModule, :some_function, args)
Specs
Returns a multi miner
client for the given list of
Merchant API endpoints.
Specs
Concurrently runs the asynchronous operation on the given multi miner
client, yielding the response from any or all of the miners.
By default, multi miner operations will yield until any of the miners
respond. Alternatively, a multi client can be initialized with the option
yield: :all
which awaits for all miner clients to respond.