Documentation
¶
Overview ¶
Package phase provides phase constants and state machine logic for the Effectiveness Monitor. Phase constants are re-exported from the API package (api/effectivenessassessment/v1alpha1) for internal EM convenience and provides state machine logic (IsTerminal, CanTransition, Validate).
Per Viceversa Pattern: API defines constants, this package re-exports + adds state machine.
Business Requirements: - BR-EM-005: Phase state transitions (Pending -> Stabilizing -> Assessing -> Completed/Failed)
Index ¶
Constants ¶
const ( // Pending - EA created by RO, EM has not reconciled yet. Pending = eav1.PhasePending // WaitingForPropagation - EM is waiting for async change to propagate // (GitOps sync, operator reconciliation) before computing hash. // Reference: DD-EM-004 v2.0, BR-EM-010.3, Issue #253 WaitingForPropagation = eav1.PhaseWaitingForPropagation // Stabilizing - EM is waiting for stabilization window to elapse. Stabilizing = eav1.PhaseStabilizing // Assessing - EM is actively performing assessment checks. Assessing = eav1.PhaseAssessing // Completed - All assessment checks finished (or validity expired). Completed = eav1.PhaseCompleted // Failed - Assessment could not be performed. Failed = eav1.PhaseFailed )
Re-export API constants for internal EM convenience. External consumers should import from api/effectivenessassessment/v1alpha1 directly.
Variables ¶
var ValidTransitions = map[Phase][]Phase{ Pending: {WaitingForPropagation, Stabilizing, Assessing, Failed}, WaitingForPropagation: {Stabilizing, Failed}, Stabilizing: {Assessing, Failed}, Assessing: {Completed, Failed}, Completed: {}, Failed: {}, }
ValidTransitions defines the state machine for EA phases. Key: current phase, Value: list of valid target phases.
Functions ¶
func CanTransition ¶
CanTransition checks if transition from current to target is valid.
func IsTerminal ¶
IsTerminal returns true if the phase is a terminal state.