View Source Skitter.DSL.Strategy.Helpers (Skitter v0.6.3)
Macros to be used in strategy hooks.
This module defines various macro "primitives" to be used in Skitter.DSL.Strategy.defhook/2
.
The contents of this module are automatically available inside defhook
.
The macros defined in this module do not offer new functionality. Instead, they provide syntactic sugar over calling existing functions with arguments based on the context passed to the strategy hook.
Link to this section Summary
Functions
Call callback
of the current operation with args
.
Call callback
of the current operation with args
.
Call callback
of the current operation with args
and config
.
Call callback
of the current operation with state
, config
and args
.
Call callback
of the current operation if it exists.
Call callback
of the current operation if it exists.
Call callback
of the current operation if it exists.
Call callback
of the current operation if it exists.
Emit data for the current context.
Raise a Skitter.StrategyError
Get the index of the given in port
.
Get the name of the in port with the given index
.
Get the name of the out port with the given index
.
Create an empty state for the operation.
Create a worker using Skitter.Worker.create_local/3
.
Get the index of the given out port
.
Send a message to a worker using the Elixir's Kernel.send/2
.
Create a worker using Skitter.Worker.create_remote/4
.
Send a message to a worker with Skitter.Worker.send/2
Stop the current worker using Skitter.Worker.stop/1
Stop the given worker using Skitter.Worker.stop/1
Programmatically create output for all out ports.
Programmatically create output for the out port with index
.
Link to this section Functions
Call callback
of the current operation with args
.
Uses Skitter.Operation.call/2
.
Call callback
of the current operation with args
.
Uses Skitter.Operation.call/3
.
Call callback
of the current operation with args
and config
.
Uses Skitter.Operation.call/4
.
Call callback
of the current operation with state
, config
and args
.
Uses Skitter.Operation.call/5
.
Call callback
of the current operation if it exists.
Call callback
of the current operation if it exists.
Call callback
of the current operation if it exists.
Call callback
of the current operation if it exists.
Emit data for the current context.
Raise a Skitter.StrategyError
The error is automatically annotated with the current context, which is used to retrieve the current operation and strategy.
Get the index of the given in port
.
Get the name of the in port with the given index
.
Get the name of the out port with the given index
.
Create an empty state for the operation.
This macro creates an initial state for an operation, by using
Skitter.Operation.initial_state/1
Create a worker using Skitter.Worker.create_local/3
.
This macro creates a local worker, automatically passing the current context.
Get the index of the given out port
.
Send a message to a worker using the Elixir's Kernel.send/2
.
send/2
and send/3
defined in this module call Skitter.Worker.send/2
which will send a
message to a worker, eventually causing its Skitter.Strategy.Operation.process/4
hook to be
called.
In contrast, this function uses the built-in Kernel.send/2
of Elixir, which sends a message to
a pid. This is useful when you need to use Kernel.SpecialForms.receive/1
inside a hook.
Create a worker using Skitter.Worker.create_remote/4
.
This macro creates a remote worker, automatically passing the current context.
Send a message to a worker with Skitter.Worker.send/2
Stop the current worker using Skitter.Worker.stop/1
Stop the given worker using Skitter.Worker.stop/1
Programmatically create output for all out ports.
The data must be wrapped in a list.
Programmatically create output for the out port with index
.
The data must be wrapped in a list.