View Source Skitter.Strategy (Skitter v0.5.3)
Strategy type definition and utilities.
A strategy is a reusable strategy which determines how a component is distributed at runtime. It is defined as a collection of hooks: functions which each define an aspect of the distributed behaviour of a component.
A strategy is defined as an elixir module which implements the Skitter.Strategy.Component
behaviour. It is recommended to define a strategy with Skitter.DSL.Strategy.defstrategy/3
.
This module defines the strategy and context types.
Link to this section Summary
Link to this section Types
Specs
context() :: %Skitter.Strategy.Context{ _skr: any(), args: Skitter.Workflow.args(), component: Skitter.Component.t(), deployment: Skitter.Deployment.data() | nil, invocation: Skitter.Invocation.t() | nil, strategy: t() }
Context information for strategy hooks.
A strategy hook often needs information about the context in which it is being called. Relevant information about the context is stored inside the context, which is passed as the first argument to every hook.
The following information is stored:
component
: The component for which the hook is called.strategy
: The strategy of the component.args
: The arguments passed to the component in the workflow.deployment
: The current deployment data.nil
if the deployment is not created yet (e.g. indeploy
)invocation
: The current invocation data.nil
for hooks that do not have access to the invocation._skr
: Data stored by the runtime system. This data should not be accessed or modified.
Specs
t() :: module()
A strategy is defined as a module.