View Source Skitter.DSL.Strategy.Helpers (Skitter v0.5.0)
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 component with args
.
Call callback
of the current component with args
.
Call callback
of the current component with args
and config
.
Call callback
of the current component with state
, config
and args
.
Call callback
of the current component if it exists.
Call callback
of the current component if it exists.
Call callback
of the current component if it exists.
Call callback
of the current component if it exists.
Emit data for the current context.
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 component.
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/3
Send a message to a worker with Skitter.Worker.send/3
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 component with args
.
Uses Skitter.Component.call/2
.
Call callback
of the current component with args
.
Uses Skitter.Component.call/3
.
Call callback
of the current component with args
and config
.
Uses Skitter.Component.call/4
.
Call callback
of the current component with state
, config
and args
.
Uses Skitter.Component.call/5
.
Call callback
of the current component if it exists.
Call callback
of the current component if it exists.
Call callback
of the current component if it exists.
Call callback
of the current component if it exists.
Emit data for the current context.
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 component 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 component.
This macro creates an initial state for a component, by using
Skitter.Component.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/3
which will send a
message to a worker, eventually causing its Skitter.Strategy.Component.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/3
The invocation is inferred from the current invocation.
Send a message to a worker with Skitter.Worker.send/3
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.