pub struct InputState {
pub input_id: InputId,
pub policy: Option<PolicySnapshot>,
pub durability: Option<InputDurability>,
pub idempotency_key: Option<IdempotencyKey>,
pub recovery_count: u32,
pub reconstruction_source: Option<ReconstructionSource>,
pub persisted_input: Option<Input>,
pub created_at: DateTime<Utc>,
/* private fields */
}Expand description
Full state of an input in the runtime.
Canonical lifecycle state (phase, terminal_outcome, history, last_run_id,
last_boundary_sequence, updated_at) is owned by the embedded
InputLifecycleAuthority. All transitions must flow through
InputState::apply. Direct mutation of canonical fields is not possible.
Operational fields (input_id, policy, durability, idempotency_key, etc.) are caller-managed and do not participate in the state machine.
Fields§
§input_id: InputIdThe input ID.
policy: Option<PolicySnapshot>Policy snapshot applied to this input.
durability: Option<InputDurability>Durability requirement (retained for recovery correctness).
idempotency_key: Option<IdempotencyKey>Idempotency key (retained for dedup across restarts).
recovery_count: u32Number of times this input has been recovered.
reconstruction_source: Option<ReconstructionSource>How to reconstruct this input (for derived inputs).
persisted_input: Option<Input>Persisted input payload used to rebuild queued work after recovery.
created_at: DateTime<Utc>When the input was created.
Implementations§
Source§impl InputState
impl InputState
Sourcepub fn new_accepted(input_id: InputId) -> Self
pub fn new_accepted(input_id: InputId) -> Self
Create a new InputState in the Accepted state.
Sourcepub fn current_state(&self) -> InputLifecycleState
pub fn current_state(&self) -> InputLifecycleState
Current lifecycle state.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if the input is in a terminal state.
Sourcepub fn terminal_outcome(&self) -> Option<&InputTerminalOutcome>
pub fn terminal_outcome(&self) -> Option<&InputTerminalOutcome>
Terminal outcome (set when state becomes terminal).
Sourcepub fn history(&self) -> &[InputStateHistoryEntry]
pub fn history(&self) -> &[InputStateHistoryEntry]
State transition history.
Sourcepub fn last_run_id(&self) -> Option<&RunId>
pub fn last_run_id(&self) -> Option<&RunId>
Last run that touched this input.
Sourcepub fn last_boundary_sequence(&self) -> Option<u64>
pub fn last_boundary_sequence(&self) -> Option<u64>
Boundary receipt sequence for the last applied run.
Sourcepub fn updated_at(&self) -> DateTime<Utc>
pub fn updated_at(&self) -> DateTime<Utc>
When the input was last updated.
Sourcepub fn attempt_count(&self) -> u32
pub fn attempt_count(&self) -> u32
Number of times this input has been staged for a run (retry budget).
Owned by InputLifecycleAuthority. No shadow copy on InputState.
Sourcepub fn apply(
&mut self,
input: InputLifecycleInput,
) -> Result<InputLifecycleTransition, InputLifecycleError>
pub fn apply( &mut self, input: InputLifecycleInput, ) -> Result<InputLifecycleTransition, InputLifecycleError>
Apply a lifecycle input through the authority.
This is the ONLY way to mutate canonical lifecycle state.
Sourcepub fn can_accept(&self, input: &InputLifecycleInput) -> bool
pub fn can_accept(&self, input: &InputLifecycleInput) -> bool
Check if a transition would be accepted without applying it.
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 (for Superseded/Coalesced which need caller-provided data).
Get a reference to the authority (for advanced read-only operations).
Get a mutable reference to the authority (for recovery paths).
Trait Implementations§
Source§impl Clone for InputState
impl Clone for InputState
Source§fn clone(&self) -> InputState
fn clone(&self) -> InputState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more