Skip to main content

ClaimedRunRecovery

Struct ClaimedRunRecovery 

Source
pub struct ClaimedRunRecovery<'store> { /* private fields */ }
Expand description

Fence-bound, corruption-quarantining read surface for one claimed run.

A session is created only after the database confirms the exact live RunFence, runnable projection, tenant/run scope, and journal observation. Every recovery read exposed here maps durable StoreError::CorruptData through one stable CorruptionQuarantineContext. Ordinary availability, cursor, contention, and stale-observation failures never quarantine.

The initial snapshot is evidence about the recovery starting point, not an authorization to perform external I/O. Manual page consumers call Self::revalidate before handing recovered work to a durable start API. Self::plan_ready_nodes performs that final revalidation itself, and PostgresStore::start_recovered_node_attempt remains the authoritative transactional dispatch fence.

Implementations§

Source§

impl ClaimedRunRecovery<'_>

Source

pub const fn fence(&self) -> &RunFence

Returns the exact worker fence validated when this session was created.

Source

pub const fn quarantine_context(&self) -> &CorruptionQuarantineContext

Returns the stable corruption evidence intent used by every read.

Source

pub const fn initial_run(&self) -> &StoredRun

Returns the fully validated run snapshot observed at session creation.

Source

pub const fn initial_observed_at(&self) -> Timestamp

Returns the database clock observed atomically with the initial run and live-fence validation.

Source

pub async fn revalidate(&self) -> Result<StoredRun, StoreError>

Rechecks the live fence, runnable projection, and exact journal head.

Recovery callers should invoke this after consuming their bounded pages and before preparing any durable dispatch attempt. A lease renewal under the same fence is accepted; expiry, supersession, quarantine, lifecycle removal, or journal progress aborts the handoff explicitly.

§Errors

Returns fencing, lifecycle, stale-observation, corruption/quarantine, or database failures. Corruption is quarantined before this method returns.

Source

pub async fn load_pinned_graph( &self, ) -> Result<StoredGraphDefinition, StoreError>

Loads the exact compiled graph pinned by this recovery checkpoint.

The method revalidates the live fence and journal observation both before and after loading the immutable checkpoint and tenant registry row. It recompiles the canonical definition, verifies its digest and owner-qualified identity, and rejects unknown ready nodes or an initial ready set that differs from the compiled entry set.

§Errors

Returns StoreError::ReadyNodeRecoveryCheckpointMissing before an initial checkpoint exists. A missing, mismatched, or corrupt pinned definition is quarantined before returning StoreError::RunQuarantined.

Source

pub async fn validate_noninitial_replay<V, R>( &self, schemas: &V, reducer: &R, limits: GraphReplayLimits, ) -> Result<GraphReplayReport, StoreError>

Independently replays every committed noninitial checkpoint transition.

Lineage pages are streamed newest-to-oldest while retaining only the current child. For each parent, the provider reloads every exact pending result and its consumption row in one repeatable-read transaction, enforces the configured compact-byte ceiling, then closes that transaction before invoking the schema registry or reducer. The graph planner is given the already committed child’s checkpoint ID and its derived successor write must match every semantic child field.

A schema/reducer that is unavailable, panics, or cannot satisfy its local resource bound is an operational deployment failure and does not quarantine durable data. Missing results, invalid consumption rows, rejected durable values, nondeterministic state/routing, and any other parent-to-child mismatch are payload-redacted corruption and trigger the session’s exact fence-protected quarantine before this method returns. A final snapshot revalidates the original journal observation, current checkpoint pointer, runnable lifecycle, and live fence.

§Errors

Returns StoreError::ReadyNodeRecoveryCheckpointMissing before an initial checkpoint, StoreError::GraphReplayDependencyUnavailable for missing or failed executable dependencies, StoreError::GraphReplayResourceLimit when one barrier exceeds limits, ordinary fencing/database/staleness errors, or StoreError::RunQuarantined after a durable replay mismatch is isolated.

Source

pub async fn plan_ready_nodes( &self, ) -> Result<ReadyNodeRecoveryPlan, StoreError>

Reconstructs the exact current checkpoint ready set into one deterministic, database-time recovery plan.

The provider loads the immutable checkpoint pinned when this session began, streams fully verified unconsumed results in bounded pages, then streams every ready activation’s complete physical-attempt history. A final database snapshot revalidates the exact journal observation and live fence before classifying fresh work, crash takeover, delayed retry, same-fence in-flight work, terminal failure, attempt exhaustion, or barrier-ready reuse.

The returned plan is not dispatch authority. Hand each selected node to PostgresStore::start_recovered_node_attempt; that API binds the plan to an exact worker append and repeats the decisive checkpoint, latest history transition, database-clock retry, journal, lifecycle, and live-fence checks.

§Errors

Returns StoreError::ReadyNodeRecoveryCheckpointMissing before the run has an initial checkpoint. Cursor, availability, lifecycle, or fencing races are explicit and do not quarantine. Any durable checkpoint/result/attempt contradiction is converted to payload-redacted corruption and fenced quarantine before return.

Source

pub async fn load_checkpoint_lineage_page( &self, from: Option<&CheckpointHead>, page_size: CheckpointLineagePageSize, ) -> Result<CheckpointLineagePage, StoreError>

Loads one bounded current checkpoint-lineage page through quarantine.

§Errors

Returns the underlying cursor, durable-state, fencing-independent read, quarantine, or database failure. Corruption is quarantined first.

Source

pub async fn load_journal_page( &self, after: Option<&JournalHead>, page_size: JournalPageSize, ) -> Result<JournalPage, StoreError>

Loads one bounded journal page through quarantine.

§Errors

Returns the underlying cursor, durable-state, quarantine, or database failure. Corruption is quarantined first.

Source

pub async fn load_tool_invocation_history_page( &self, invocation_id: InvocationId, after: Option<&ToolInvocation>, page_size: ToolInvocationHistoryPageSize, ) -> Result<ToolInvocationHistoryPage, StoreError>

Loads one bounded tool-invocation history page through quarantine.

§Errors

Returns the underlying not-found, cursor, durable-state, quarantine, or database failure. Corruption is quarantined first.

Source

pub async fn load_model_invocation_history_page( &self, invocation_id: InvocationId, after: Option<&ModelInvocation>, page_size: ModelInvocationHistoryPageSize, ) -> Result<ModelInvocationHistoryPage, StoreError>

Loads one bounded model-invocation history page through quarantine.

§Errors

Returns the underlying not-found, cursor, durable-state, quarantine, or database failure. Corruption is quarantined first.

Source

pub async fn load_node_attempt_history_page( &self, activation: &NodeActivation, cursor: Option<&NodeAttempt>, page_size: NodeAttemptHistoryPageSize, ) -> Result<NodeAttemptHistoryPage, StoreError>

Loads one bounded physical node-attempt history page through quarantine.

§Errors

Returns StoreError::InvalidClaimedRunRecoveryContext when the activation crosses this session, otherwise the underlying cursor, durable-state, quarantine, or database failure.

Source

pub async fn load_unconsumed_pending_node_result_page( &self, base: &CheckpointHead, cursor: Option<&PendingNodeResultPageCursor>, page_size: PendingNodeResultPageSize, ) -> Result<PendingNodeResultPage, StoreError>

Loads one bounded page of unconsumed node results through quarantine.

§Errors

Returns StoreError::InvalidClaimedRunRecoveryContext when the base checkpoint crosses this session, otherwise the underlying cursor, durable-state, quarantine, or database failure.

Auto Trait Implementations§

§

impl<'store> !RefUnwindSafe for ClaimedRunRecovery<'store>

§

impl<'store> !UnwindSafe for ClaimedRunRecovery<'store>

§

impl<'store> Forget for ClaimedRunRecovery<'store>

§

impl<'store> Freeze for ClaimedRunRecovery<'store>

§

impl<'store> Move for ClaimedRunRecovery<'store>

§

impl<'store> Send for ClaimedRunRecovery<'store>

§

impl<'store> Sync for ClaimedRunRecovery<'store>

§

impl<'store> Unpin for ClaimedRunRecovery<'store>

§

impl<'store> UnsafeUnpin for ClaimedRunRecovery<'store>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more