Skip to main content

QueuedWorkStore

Trait QueuedWorkStore 

Source
pub trait QueuedWorkStore: Send + Sync {
    // Required methods
    fn enqueue_queued_work<'life0, 'async_trait>(
        &'life0 self,
        batch: QueuedWorkBatchDraft,
    ) -> Pin<Box<dyn Future<Output = Result<QueuedWorkBatch, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn claim_leading_ready_session_command<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        session_execution_lease: &'life2 SessionExecutionLeaseFence,
        owner: &'life3 LeaseOwnerIdentity,
        lease_ttl_ms: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkClaim>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             Self: 'async_trait;
    fn claim_ready_queued_work<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        session_execution_lease: &'life2 SessionExecutionLeaseFence,
        owner: &'life3 LeaseOwnerIdentity,
        boundary: QueuedWorkClaimBoundary,
        lease_ttl_ms: u64,
        max_batches: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkClaim>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             Self: 'async_trait;
    fn renew_queued_work_claim<'life0, 'life1, 'async_trait>(
        &'life0 self,
        claim: &'life1 QueuedWorkClaim,
        lease_ttl_ms: u64,
    ) -> Pin<Box<dyn Future<Output = Result<QueuedWorkClaim, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn abandon_queued_work_claim<'life0, 'life1, 'async_trait>(
        &'life0 self,
        claim: &'life1 QueuedWorkClaim,
    ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn cancel_queued_work_batch<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        batch_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn list_queued_work<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn list_pending_queued_work<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn claim_ready_queued_work_by_batch_ids<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        session_id: &'life1 str,
        session_execution_lease: &'life2 SessionExecutionLeaseFence,
        owner: &'life3 LeaseOwnerIdentity,
        boundary: QueuedWorkClaimBoundary,
        lease_ttl_ms: u64,
        batch_ids: &'life4 [String],
    ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkClaim>, StoreError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

Durable queued-work capability: ingress, ordered claiming, and claim leases for non-input work (process wakes and session commands).

Claims granted here are completed atomically by SessionCommitStore::commit_runtime_state.

Required Methods§

Source

fn enqueue_queued_work<'life0, 'async_trait>( &'life0 self, batch: QueuedWorkBatchDraft, ) -> Pin<Box<dyn Future<Output = Result<QueuedWorkBatch, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Persist a queued-work batch for later claiming.

Source

fn claim_leading_ready_session_command<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, session_id: &'life1 str, session_execution_lease: &'life2 SessionExecutionLeaseFence, owner: &'life3 LeaseOwnerIdentity, lease_ttl_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkClaim>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Claim a leading ready session-command batch for owner_id.

A command claim is returned only when the earliest ready claimable batch is classified as crate::runtime::QueuedWorkClass::SessionCommand. Backends derive the class from queued payloads; no schema column is required.

Source

fn claim_ready_queued_work<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, session_id: &'life1 str, session_execution_lease: &'life2 SessionExecutionLeaseFence, owner: &'life3 LeaseOwnerIdentity, boundary: QueuedWorkClaimBoundary, lease_ttl_ms: u64, max_batches: usize, ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkClaim>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Claim the next ready turn-work group for owner_id.

A turn-work claim is returned only when the earliest ready claimable batch is classified as crate::runtime::QueuedWorkClass::TurnWork. Earlier ready session commands are not skipped and are never materialized as turn input.

Source

fn renew_queued_work_claim<'life0, 'life1, 'async_trait>( &'life0 self, claim: &'life1 QueuedWorkClaim, lease_ttl_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<QueuedWorkClaim, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Extend the lease on a held queued-work claim.

Source

fn abandon_queued_work_claim<'life0, 'life1, 'async_trait>( &'life0 self, claim: &'life1 QueuedWorkClaim, ) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Release a held queued-work claim without completing it.

Source

fn cancel_queued_work_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session_id: &'life1 str, batch_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Remove an unclaimed queued-work batch from durable ingress.

Returns the removed batch when cancellation won the race. Returns None when the batch is missing or currently held by a live claim; callers must treat that as “already claimed or completed” and must not restore any stale local draft state.

Source

fn list_queued_work<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

List all queued-work batches for a session, including batches held by a live claim.

Source

fn list_pending_queued_work<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<QueuedWorkBatch>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

List queued-work batches that are still pending presentation/editing.

This excludes batches currently held by a live claim. Expired claims are considered pending again because they can be reclaimed or cancelled.

This is a distinct required query, not a derivation of list_queued_work: the two differ by claim-state filter, and backends answer each with its own query over claim rows rather than leaking claim state to callers for client-side filtering.

Provided Methods§

Source

fn claim_ready_queued_work_by_batch_ids<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, session_id: &'life1 str, session_execution_lease: &'life2 SessionExecutionLeaseFence, owner: &'life3 LeaseOwnerIdentity, boundary: QueuedWorkClaimBoundary, lease_ttl_ms: u64, batch_ids: &'life4 [String], ) -> Pin<Box<dyn Future<Output = Result<Option<QueuedWorkClaim>, StoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

Claim a specific ready batch set selected from the durable queue.

This is the host-facing counterpart to claim_ready_queued_work: callers that project queued work into a UI can claim the exact batch ids they rendered instead of reconstructing authority from local draft state.

Provided derivation: preserves the ordered queue contract by claiming the next ready group and returning it only when the durable ids match exactly, abandoning the claim otherwise. Backends may override it with a native query; none currently need to.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§