Skip to main content

SqlitePendingStore

Struct SqlitePendingStore 

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

SQLite-backed PendingAdjudicationPort implementation.

Shares the same connection mutex as SqlitePersistenceStore but operates OUTSIDE the claim transaction — reads and writes go directly on the connection (no BEGIN/COMMIT wrapping). The per-agent write lock held by EngineHandle ensures these writes are serialized with the claim txn commit.

Construct via SqlitePendingStore::new(conn_arc) sharing the same connection Arc as the SqlitePersistenceStore.

Implementations§

Source§

impl SqlitePendingStore

Source

pub fn new(conn: Arc<Mutex<Option<Box<Connection>>>>) -> Self

Create a pending store sharing the connection with a SqlitePersistenceStore.

Trait Implementations§

Source§

impl PendingAdjudicationPort for SqlitePendingStore

Source§

fn list_queued_orphan_claims( &self, ) -> Result<Vec<OrphanedQueuedClaim>, SqliteStoreError>

Detect QueuedForAdjudication claims (by latest ledger disposition) with no matching pending row (status = ‘pending’).

Approach: find claim_ids whose most-recent ledger entry has disposition = ‘QueuedForAdjudication’ via a subquery on max(recorded_at), then check for absence of a matching pending_adjudications row. Returns orphaned claim refs with agent_id, subject, predicate, and best-guess incumbent.

NOTE: The schema uses claim_id (not claim_ref) in ledger_entries and claims.

Source§

type Error = SqliteStoreError

Source§

fn insert_pending( &self, row: &PendingAdjudicationRow, ) -> Result<(), SqliteStoreError>

Persist a new pending-adjudication row (status = ‘pending’, expires_at = NULL). Read more
Source§

fn get_pending( &self, handle_id: Uuid, ) -> Result<Option<PendingAdjudicationRow>, SqliteStoreError>

Lookup a pending row by its handle_id. Returns None if not found.
Source§

fn list_pending( &self, agent_id: Option<&AgentId>, ) -> Result<Vec<PendingAdjudicationRow>, SqliteStoreError>

List all pending rows for an agent (or all agents if agent_id is None). Ordered by queued_at ASC.
Source§

fn list_expired( &self, now: DateTime<Utc>, ) -> Result<Vec<PendingAdjudicationRow>, SqliteStoreError>

List all rows whose expires_at is not NULL, expires_at <= now, and status = 'pending'. Used by the sweep use-case. Ordered by expires_at ASC.
Source§

fn mark_resolved(&self, handle_id: Uuid) -> Result<(), SqliteStoreError>

Mark a pending row as resolved (status = ‘resolved’). Used by the verdict-apply step. Read more
Source§

fn mark_expired(&self, handle_id: Uuid) -> Result<(), SqliteStoreError>

Mark a pending row as expired (status = ‘expired’). Used by the sweep and lazy expiry path. Read more
Source§

impl Send for SqlitePendingStore

Source§

impl Sync for SqlitePendingStore

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<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, 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.