Durable, idempotent command for controlling one operational loop.
Summary
Functions
Marks the command as :applied, stamping completed_at with the current time.
Marks the command as :committed, stamping committed_at with the current time.
Builds a pending control command for loop_id.
Marks the command as :rejected with reason, stamping completed_at with
the current time.
Validates the command's identity, action, mode, timestamps and portability.
Types
@type t() :: %Spectre.Operation.Control.Command{ action: atom(), base_revision: non_neg_integer() | nil, causation_id: String.t() | nil, committed_at: non_neg_integer() | nil, completed_at: non_neg_integer() | nil, correlation_id: String.t(), desired_state: :active | :paused | :terminal | nil, id: String.t(), loop_id: String.t(), metadata: map(), mode: :safe | :immediate, payload: term(), provenance: map(), rejection: term(), requested_at: non_neg_integer(), status: :pending | :committed | :applied | :rejected }
Functions
Marks the command as :applied, stamping completed_at with the current time.
Marks the command as :committed, stamping committed_at with the current time.
Builds a pending control command for loop_id.
action must be one of :pause, :update, :resume, :stop, :renew,
:trigger or :update_and_resume; the desired loop state is derived from it
unless :desired_state is given. Missing ids and requested_at default to
fresh UUIDv7s and the current time. Raises ArgumentError on an invalid mode.
Marks the command as :rejected with reason, stamping completed_at with
the current time.
Validates the command's identity, action, mode, timestamps and portability.
Returns :ok, or {:error, reason} naming the first invalid field or the
status whose timestamps are inconsistent.