pub struct InputLifecycleAuthority { /* private fields */ }Expand description
The canonical authority for InputLifecycle state.
Holds the canonical phase + fields and delegates all transitions through
the encoded transition table. The authority OWNS the canonical state –
callers cannot get &mut access to the inner fields.
Implementations§
Source§impl InputLifecycleAuthority
impl InputLifecycleAuthority
Sourcepub fn new_at(now: DateTime<Utc>) -> Self
pub fn new_at(now: DateTime<Utc>) -> Self
Create a new authority in the Accepted state with a caller-owned timestamp.
Use this when the caller already captured a canonical now to ensure
updated_at is consistent with sibling timestamps (e.g., created_at
on the owning InputState).
Sourcepub fn with_phase(phase: InputLifecycleState) -> Self
pub fn with_phase(phase: InputLifecycleState) -> Self
Create an authority initialized to a specific phase (for recovery).
Sourcepub fn restore(
phase: InputLifecycleState,
terminal_outcome: Option<InputTerminalOutcome>,
last_run_id: Option<RunId>,
last_boundary_sequence: Option<u64>,
attempt_count: u32,
history: Vec<InputStateHistoryEntry>,
updated_at: DateTime<Utc>,
) -> Self
pub fn restore( phase: InputLifecycleState, terminal_outcome: Option<InputTerminalOutcome>, last_run_id: Option<RunId>, last_boundary_sequence: Option<u64>, attempt_count: u32, history: Vec<InputStateHistoryEntry>, updated_at: DateTime<Utc>, ) -> Self
Restore an authority from persisted state (for crash recovery).
This reconstructs the authority from a previously-serialized snapshot, including all canonical fields and history.
Sourcepub fn phase(&self) -> InputLifecycleState
pub fn phase(&self) -> InputLifecycleState
Current phase (read from canonical state).
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Whether the current phase is terminal.
Sourcepub fn terminal_outcome(&self) -> Option<&InputTerminalOutcome>
pub fn terminal_outcome(&self) -> Option<&InputTerminalOutcome>
Current terminal outcome (if in a terminal state).
Sourcepub fn last_run_id(&self) -> Option<&RunId>
pub fn last_run_id(&self) -> Option<&RunId>
Last run ID that touched this input.
Sourcepub fn last_boundary_sequence(&self) -> Option<u64>
pub fn last_boundary_sequence(&self) -> Option<u64>
Last boundary sequence number.
Sourcepub fn attempt_count(&self) -> u32
pub fn attempt_count(&self) -> u32
Number of times this input has been staged for a run.
Sourcepub fn history(&self) -> &[InputStateHistoryEntry]
pub fn history(&self) -> &[InputStateHistoryEntry]
State transition history.
Sourcepub fn updated_at(&self) -> DateTime<Utc>
pub fn updated_at(&self) -> DateTime<Utc>
Timestamp of last state change.
Sourcepub fn can_accept(&self, input: &InputLifecycleInput) -> bool
pub fn can_accept(&self, input: &InputLifecycleInput) -> bool
Check if a transition is legal without applying it.
Sourcepub fn require_phase(
&self,
allowed: &[InputLifecycleState],
) -> Result<(), InputLifecycleError>
pub fn require_phase( &self, allowed: &[InputLifecycleState], ) -> Result<(), InputLifecycleError>
Require that the authority is in one of the given phases.
Sourcepub fn set_terminal_outcome(&mut self, outcome: InputTerminalOutcome)
pub fn set_terminal_outcome(&mut self, outcome: InputTerminalOutcome)
Set the terminal outcome after a transition.
Used by shell code for Superseded/Coalesced which need caller-provided data (superseded_by / aggregate_id) that the authority’s transition doesn’t know at evaluate-time.
Sourcepub fn stamp_receipt_metadata(&mut self, run_id: RunId, boundary_sequence: u64)
pub fn stamp_receipt_metadata(&mut self, run_id: RunId, boundary_sequence: u64)
Stamp receipt metadata onto the authority state.
Used by the store layer after it generates an authoritative receipt with a sequence number. This is NOT a lifecycle transition – it’s operational metadata enrichment by the persistence layer.
Trait Implementations§
Source§impl Clone for InputLifecycleAuthority
impl Clone for InputLifecycleAuthority
Source§fn clone(&self) -> InputLifecycleAuthority
fn clone(&self) -> InputLifecycleAuthority
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more