Skip to main content

PendingSubmissionStore

Struct PendingSubmissionStore 

Source
pub struct PendingSubmissionStore { /* private fields */ }
Expand description

SQLite sidecar that stores accepted but uncompleted Session work.

Implementations§

Source§

impl PendingSubmissionStore

Source

pub fn for_session(session: &Session) -> Self

Opens the sidecar adjacent to a Session transcript.

Source

pub fn for_session_file(session_file: &Path, session_id: &str) -> Self

Opens the sidecar adjacent to an arbitrary Session transcript path.

Source

pub fn path(&self) -> &Path

Returns the sidecar path.

Source

pub fn runtime_generation(&self) -> Result<u64, PendingSubmissionError>

Loads the durable runtime generation for this logical Session.

Legacy Sessions without the metadata key are initialized at generation zero. Process reconstruction rehydrates this exact value so accepted envelopes remain addressable after memory loss.

Source

pub fn runtime_state( &self, ) -> Result<Option<SessionRuntimeState>, PendingSubmissionError>

Loads the compaction-independent current Session runtime identity.

Source

pub fn has_nonterminal_submissions( &self, ) -> Result<bool, PendingSubmissionError>

Returns whether this Session still owns accepted, paused, or running work.

Source

pub fn initialize_runtime_identity( &self, identity: SessionRuntimeIdentity, ) -> Result<SessionRuntimeState, PendingSubmissionError>

Initializes a new/legacy Session with an exact committed runtime identity.

Repeating the same initialization is idempotent. A contradictory identity at the same durable generation is rejected rather than silently changing the Session’s reconstruction authority.

Source

pub fn stage_runtime_activation( &self, expected: u64, activation: &SessionRuntimeActivation, ) -> Result<u64, PendingSubmissionError>

Atomically fences generation G and stages the exact G+1 activation.

The transcript marker is committed in a separate append-only store, so the sidecar records pending_marker until the caller proves that marker durable and calls Self::commit_runtime_activation. A crash at that cut point is therefore recoverable without starting a runtime from an unproven activation.

Source

pub fn commit_runtime_activation( &self, activation_id: &str, ) -> Result<SessionRuntimeState, PendingSubmissionError>

Marks a staged activation committed after its exact transcript marker is durable.

Source

pub fn advance_runtime_generation( &self, expected: u64, ) -> Result<u64, PendingSubmissionError>

Atomically advances the durable generation for a live replacement of the same logical Session.

The quiescence check and metadata update execute under the same SQLite immediate transaction used by Self::accept. Therefore either an in-flight admission wins and the fence remains at the old generation, or the fence wins and every new old-generation admission is rejected.

Source

pub fn accept( &self, submission: &StructuredSubmission, ) -> Result<(String, SubmissionReceiptDisposition), PendingSubmissionError>

Durably accepts an exact submission or returns its prior receipt.

Source

pub fn reconcile( &self, submission: &StructuredSubmission, ) -> Result<(String, SubmissionReceiptDisposition), PendingSubmissionError>

Reconciles a previously sent submission without creating custody.

Source

pub fn mark_running( &self, submission_id: &str, turn_id: &str, ) -> Result<(), PendingSubmissionError>

Marks an accepted submission as the active Turn.

Source

pub fn mark_paused( &self, submission_id: &str, ) -> Result<(), PendingSubmissionError>

Pauses one durably accepted submission before it starts.

Source

pub fn pause_unstarted(&self) -> Result<usize, PendingSubmissionError>

Pauses all accepted submissions that have not started.

Source

pub fn cancel_unstarted( &self, submission_id: &str, ) -> Result<(), PendingSubmissionError>

Explicitly terminalizes one accepted submission before Provider start.

This is the recovery action for deterministic pre-start failures. The original identity remains in the permanent idempotency ledger and can never execute as fresh work later.

Source

pub fn mark_terminal( &self, submission_id: &str, state: PendingSubmissionState, turn_id: &str, ) -> Result<(), PendingSubmissionError>

Marks a started submission terminal without making it resumable.

Source

pub fn mark_committed( &self, submission_id: &str, turn_id: &str, ) -> Result<(), PendingSubmissionError>

Finalizes custody from the authoritative terminal transcript outcome.

Success becomes Committed. Error and Cancelled markers are mapped to their matching terminal states even when the caller is the legacy startup path named mark_committed. A real transcript file with no marker is ambiguous and remains Running. Preview requests are the only transcript-free successful structured kind and are validated from the immutable journal payload before taking that compatibility path.

Source

pub fn recover_unstarted( &self, ) -> Result<Vec<PendingSubmissionRecord>, PendingSubmissionError>

Returns unstarted work in durable FIFO order.

Source

pub fn recover_running( &self, ) -> Result<Vec<PendingSubmissionRecord>, PendingSubmissionError>

Returns Running records for transcript-backed crash reconciliation.

Source

pub fn get( &self, submission_id: &str, ) -> Result<Option<PendingSubmissionRecord>, PendingSubmissionError>

Returns one durable submission record that still retains its payload.

Trait Implementations§

Source§

impl Clone for PendingSubmissionStore

Source§

fn clone(&self) -> PendingSubmissionStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PendingSubmissionStore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.