Runbox.Scenario.OutputAction (runbox v7.0.1)
Output action represents a side effect produced by a run.
creating-output-actions
Creating output actions
Creating output action typically happens from scenario. It is done by creating one of the appropriate struct:
Runbox.Scenario.OutputAction.UpsertAssetAttributes.t/0
Runbox.Scenario.OutputAction.DeleteAssetAttributes.t/0
Runbox.Scenario.OutputAction.DeleteAllAssetAttributes.t/0
Runbox.Scenario.OutputAction.UpsertEdge.t/0
Runbox.Scenario.OutputAction.DeleteEdge.t/0
Runbox.Scenario.OutputAction.Notification.t/0
Runbox.Scenario.OutputAction.Event.t/0
Runbox.Scenario.OutputAction.ExecuteSQL.t/0
For example:
iex> %OutputAction.UpsertAssetAttributes{
...> type: "/asset/camera",
...> id: "one",
...> attributes: %{"foo" => "bar"}
...> }
asset-and-edge-output-actions
Asset and edge output actions
Changes done by output actions to assets and edges are scoped for each scenario run. The global result is computed from the changes done by individual runs.
A single run is forbidden to do multiple changes to the same object (asset attribute or edge) at the same time. However distinct runs can perform such changes, because they are scoped to each run.
The rules to compute the global state apply in the following order:
Change with the higher timestamp has precedence.
Updating an asset attribute or an edge has precedence to deleting it.
Change with the higher value has precedence (applies only for asset attributes).
Link to this section Summary
Link to this section Types
asset_id()
@type asset_id() :: String.t()
asset_type()
@type asset_type() :: String.t()
edge_type()
@type edge_type() :: String.t()
oa_params()
@type oa_params() :: Runbox.Scenario.OutputAction.UpsertAssetAttributes.t() | Runbox.Scenario.OutputAction.DeleteAssetAttributes.t() | Runbox.Scenario.OutputAction.DeleteAllAssetAttributes.t() | Runbox.Scenario.OutputAction.UpsertEdge.t() | Runbox.Scenario.OutputAction.DeleteEdge.t() | Runbox.Scenario.OutputAction.Notification.t() | Runbox.Scenario.OutputAction.Event.t() | Runbox.Scenario.OutputAction.ExecuteSQL.t() | Runbox.Scenario.OutputAction.Incident.t() | Runbox.Scenario.OutputAction.IncidentPatch.t()
@type t() :: %Runbox.Scenario.OutputAction{ body: oa_params() | Runbox.Scenario.OutputAction.BadOutputAction.t(), run_id: term(), scenario_id: term(), timestamp: integer() }
Output Action
This struct is produced by Runbox.Runtime.Stage.Sandbox.execute_run/3
.