pub struct RunLifecycle { /* private fields */ }Expand description
Immutable snapshot of one admitted run’s protocol-neutral business state.
Use Self::apply to obtain the next snapshot. The operation consumes the
old value, checks the closed transition graph and timestamps, and increments
the optimistic revision exactly once. Durable runtimes still perform the
transition and journal append atomically under an expected revision and a
valid fencing epoch.
Implementations§
Source§impl RunLifecycle
impl RunLifecycle
Sourcepub const fn admitted(
provenance: AgentResultProvenance,
admitted_at: Timestamp,
) -> Self
pub const fn admitted( provenance: AgentResultProvenance, admitted_at: Timestamp, ) -> Self
Creates the initial pending snapshot after admission has committed.
Sourcepub const fn provenance(&self) -> &AgentResultProvenance
pub const fn provenance(&self) -> &AgentResultProvenance
Returns trusted tenant, run, thread, invocation, and agent identity.
Sourcepub const fn admitted_at(&self) -> Timestamp
pub const fn admitted_at(&self) -> Timestamp
Returns the durable clock observation at admission commit.
Sourcepub const fn revision(&self) -> RunRevision
pub const fn revision(&self) -> RunRevision
Returns the current optimistic lifecycle revision.
Sourcepub const fn changed_at(&self) -> Timestamp
pub const fn changed_at(&self) -> Timestamp
Returns the most recent committed lifecycle observation.
Sourcepub const fn waits(&self) -> Option<&RunWaits>
pub const fn waits(&self) -> Option<&RunWaits>
Returns outstanding conditions only while waiting.
Sourcepub const fn cancellation_request(&self) -> Option<&RunCancellationRequest>
pub const fn cancellation_request(&self) -> Option<&RunCancellationRequest>
Returns cancellation intent while requested or terminally cancelled.
Sourcepub const fn result(&self) -> Option<&AgentResult>
pub const fn result(&self) -> Option<&AgentResult>
Returns the successful terminal result, if committed.
Sourcepub const fn terminal_failure(&self) -> Option<&Failure>
pub const fn terminal_failure(&self) -> Option<&Failure>
Returns the terminal failure occurrence for failed or cancelled runs.
Sourcepub const fn terminal_usage(&self) -> Option<&BudgetUsage>
pub const fn terminal_usage(&self) -> Option<&BudgetUsage>
Returns terminal cumulative usage for any completed outcome.
Sourcepub fn apply(
self,
transition: RunTransition,
) -> Result<Self, RunTransitionError>
pub fn apply( self, transition: RunTransition, ) -> Result<Self, RunTransitionError>
Applies one intrinsically valid lifecycle transition.
A successful result is rebound to the trusted run provenance here.
Before a durable terminal commit, the runtime must also call
AgentResult::validate_for with the exact admitted request,
descriptor snapshot, resolved budget, and digest-pinned schema
validation result. Those values intentionally are not duplicated in
every lifecycle snapshot.
§Errors
Returns RunTransitionError for a transition outside the closed
graph, a regressing clock, a stale/expired resolution, an early timer,
substituted result provenance, or revision overflow.
Trait Implementations§
Source§impl Clone for RunLifecycle
impl Clone for RunLifecycle
Source§impl Debug for RunLifecycle
impl Debug for RunLifecycle
Source§impl<'de> Deserialize<'de> for RunLifecycle
impl<'de> Deserialize<'de> for RunLifecycle
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl JsonSchema for RunLifecycle
impl JsonSchema for RunLifecycle
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more