lib/runbox/runtime/runtime_instruction.ex
defmodule Runbox.Runtime.RuntimeInstruction do
@moduledoc """
Struct produced by scenario representing instruction for runtime.
"""
alias __MODULE__, as: RuntimeInstruction
defstruct body: nil
defmodule Timeout do
@moduledoc """
Instruction to register unit timeout.
"""
alias Toolbox.Message, as: Msg
defstruct unit_id: nil, timeout_message: nil
@typedoc "Struct representing unit timeout registration."
@type t :: %Timeout{timeout_message: %Msg{}}
end
@typedoc "Struct produced by scenario representing instruction for runtime."
@type t :: %RuntimeInstruction{body: Timeout.t()}
@doc """
Creates runtime instruction to register timeout message.
"""
def register_timeout(timeout_message) do
%RuntimeInstruction{body: %Timeout{timeout_message: timeout_message}}
end
end