pub struct PendingSubmissionStore { /* private fields */ }Expand description
SQLite sidecar that stores accepted but uncompleted Session work.
Implementations§
Source§impl PendingSubmissionStore
impl PendingSubmissionStore
Sourcepub fn for_session(session: &Session) -> Self
pub fn for_session(session: &Session) -> Self
Opens the sidecar adjacent to a Session transcript.
Sourcepub fn for_session_file(session_file: &Path, session_id: &str) -> Self
pub fn for_session_file(session_file: &Path, session_id: &str) -> Self
Opens the sidecar adjacent to an arbitrary Session transcript path.
Sourcepub fn runtime_generation(&self) -> Result<u64, PendingSubmissionError>
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.
Sourcepub fn runtime_state(
&self,
) -> Result<Option<SessionRuntimeState>, PendingSubmissionError>
pub fn runtime_state( &self, ) -> Result<Option<SessionRuntimeState>, PendingSubmissionError>
Loads the compaction-independent current Session runtime identity.
Sourcepub fn has_nonterminal_submissions(
&self,
) -> Result<bool, PendingSubmissionError>
pub fn has_nonterminal_submissions( &self, ) -> Result<bool, PendingSubmissionError>
Returns whether this Session still owns accepted, paused, or running work.
Sourcepub fn initialize_runtime_identity(
&self,
identity: SessionRuntimeIdentity,
) -> Result<SessionRuntimeState, PendingSubmissionError>
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.
Sourcepub fn stage_runtime_activation(
&self,
expected: u64,
activation: &SessionRuntimeActivation,
) -> Result<u64, PendingSubmissionError>
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.
Sourcepub fn commit_runtime_activation(
&self,
activation_id: &str,
) -> Result<SessionRuntimeState, PendingSubmissionError>
pub fn commit_runtime_activation( &self, activation_id: &str, ) -> Result<SessionRuntimeState, PendingSubmissionError>
Marks a staged activation committed after its exact transcript marker is durable.
Sourcepub fn advance_runtime_generation(
&self,
expected: u64,
) -> Result<u64, PendingSubmissionError>
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.
Sourcepub fn accept(
&self,
submission: &StructuredSubmission,
) -> Result<(String, SubmissionReceiptDisposition), PendingSubmissionError>
pub fn accept( &self, submission: &StructuredSubmission, ) -> Result<(String, SubmissionReceiptDisposition), PendingSubmissionError>
Durably accepts an exact submission or returns its prior receipt.
Sourcepub fn reconcile(
&self,
submission: &StructuredSubmission,
) -> Result<(String, SubmissionReceiptDisposition), PendingSubmissionError>
pub fn reconcile( &self, submission: &StructuredSubmission, ) -> Result<(String, SubmissionReceiptDisposition), PendingSubmissionError>
Reconciles a previously sent submission without creating custody.
Sourcepub fn mark_running(
&self,
submission_id: &str,
turn_id: &str,
) -> Result<(), PendingSubmissionError>
pub fn mark_running( &self, submission_id: &str, turn_id: &str, ) -> Result<(), PendingSubmissionError>
Marks an accepted submission as the active Turn.
Sourcepub fn mark_paused(
&self,
submission_id: &str,
) -> Result<(), PendingSubmissionError>
pub fn mark_paused( &self, submission_id: &str, ) -> Result<(), PendingSubmissionError>
Pauses one durably accepted submission before it starts.
Sourcepub fn pause_unstarted(&self) -> Result<usize, PendingSubmissionError>
pub fn pause_unstarted(&self) -> Result<usize, PendingSubmissionError>
Pauses all accepted submissions that have not started.
Sourcepub fn cancel_unstarted(
&self,
submission_id: &str,
) -> Result<(), PendingSubmissionError>
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.
Sourcepub fn mark_terminal(
&self,
submission_id: &str,
state: PendingSubmissionState,
turn_id: &str,
) -> Result<(), PendingSubmissionError>
pub fn mark_terminal( &self, submission_id: &str, state: PendingSubmissionState, turn_id: &str, ) -> Result<(), PendingSubmissionError>
Marks a started submission terminal without making it resumable.
Sourcepub fn mark_committed(
&self,
submission_id: &str,
turn_id: &str,
) -> Result<(), PendingSubmissionError>
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.
Sourcepub fn recover_unstarted(
&self,
) -> Result<Vec<PendingSubmissionRecord>, PendingSubmissionError>
pub fn recover_unstarted( &self, ) -> Result<Vec<PendingSubmissionRecord>, PendingSubmissionError>
Returns unstarted work in durable FIFO order.
Sourcepub fn recover_running(
&self,
) -> Result<Vec<PendingSubmissionRecord>, PendingSubmissionError>
pub fn recover_running( &self, ) -> Result<Vec<PendingSubmissionRecord>, PendingSubmissionError>
Returns Running records for transcript-backed crash reconciliation.
Sourcepub fn get(
&self,
submission_id: &str,
) -> Result<Option<PendingSubmissionRecord>, PendingSubmissionError>
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
impl Clone for PendingSubmissionStore
Source§fn clone(&self) -> PendingSubmissionStore
fn clone(&self) -> PendingSubmissionStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more