Crosswake.Companion.State (crosswake v0.2.0)

View Source

Typed runtime state snapshot returned by report_state/0.

Carries the companion's current enabled status, dependency health, gate configuration, and kill-switch position at a point in time. checked_at is a monotonic millisecond timestamp (System.monotonic_time(:millisecond)).

Stability

Public stable — part of the Crosswake companion contract surface. Semver-protected under crosswake >= 0.1.0: no breaking changes to this module's struct fields, types, or callbacks without a major version bump. Companion packages (crosswake_rulestead, crosswake_rindle, etc.) may safely alias and pattern-match on this type.

Summary

Types

t()

Runtime state snapshot for a companion at a point in time.

Types

dependency_status()

(since 0.1.0)
@type dependency_status() :: :present | {:missing, [module()]}

gate_status()

(since 0.1.0)
@type gate_status() ::
  :active | :inactive | :unconfigured | {:rolling_out, non_neg_integer()}

kill_switch_status()

(since 0.1.0)
@type kill_switch_status() :: :inactive | :active | :unconfigured

t()

(since 0.1.0)
@type t() :: %Crosswake.Companion.State{
  checked_at: non_neg_integer(),
  companion_id: atom(),
  dependency_status: dependency_status(),
  details: map(),
  enabled: boolean(),
  gate_status: gate_status(),
  kill_switch_status: kill_switch_status()
}

Runtime state snapshot for a companion at a point in time.