pub struct EnvelopeStore { /* private fields */ }Implementations§
Source§impl EnvelopeStore
impl EnvelopeStore
pub fn new(pool: SqlitePool) -> Self
Sourcepub async fn create_in_tx(
&self,
tx: &mut Transaction<'_, Sqlite>,
envelope_id: &str,
spec: &EnvelopeSpec,
parent_envelope_id: Option<&str>,
) -> KernelResult<EnvelopeRecord>
pub async fn create_in_tx( &self, tx: &mut Transaction<'_, Sqlite>, envelope_id: &str, spec: &EnvelopeSpec, parent_envelope_id: Option<&str>, ) -> KernelResult<EnvelopeRecord>
Create a new envelope within an existing transaction.
Sourcepub async fn get_active_for_actor(
&self,
actor_id: &str,
) -> KernelResult<Option<EnvelopeRecord>>
pub async fn get_active_for_actor( &self, actor_id: &str, ) -> KernelResult<Option<EnvelopeRecord>>
Get the active envelope for an actor. Returns None if no active envelope exists.
Sourcepub async fn get(
&self,
envelope_id: &str,
) -> KernelResult<Option<EnvelopeRecord>>
pub async fn get( &self, envelope_id: &str, ) -> KernelResult<Option<EnvelopeRecord>>
Get an envelope by ID.
Sourcepub async fn get_hold_request(
&self,
hold_id: &str,
) -> KernelResult<Option<Value>>
pub async fn get_hold_request( &self, hold_id: &str, ) -> KernelResult<Option<Value>>
PIP-001 §11b: Get a hold_request record by hold_id.
Sourcepub async fn list_pending_holds(
&self,
agent_id: Option<&str>,
) -> KernelResult<Vec<Value>>
pub async fn list_pending_holds( &self, agent_id: Option<&str>, ) -> KernelResult<Vec<Value>>
PIP-001 §11b: List pending hold_requests, optionally filtered by agent_id.
Returns records ordered by triggered_at ascending (oldest first).
If agent_id is None, all pending holds are returned regardless of agent.
Sourcepub async fn list_pending_holds_for_envelope(
&self,
envelope_id: &str,
) -> KernelResult<Vec<Value>>
pub async fn list_pending_holds_for_envelope( &self, envelope_id: &str, ) -> KernelResult<Vec<Value>>
PIP-001 §11e: List pending hold_requests for a specific envelope.
Sourcepub async fn create_hold_request_in_tx(
&self,
tx: &mut Transaction<'_, Sqlite>,
req: &NewHoldRequest<'_>,
) -> KernelResult<()>
pub async fn create_hold_request_in_tx( &self, tx: &mut Transaction<'_, Sqlite>, req: &NewHoldRequest<'_>, ) -> KernelResult<()>
PIP-001 §11b: Create a hold_request record within a transaction.
Sourcepub async fn resolve_hold_request_in_tx(
&self,
tx: &mut Transaction<'_, Sqlite>,
hold_id: &str,
decision: &str,
instruction: Option<&str>,
) -> KernelResult<()>
pub async fn resolve_hold_request_in_tx( &self, tx: &mut Transaction<'_, Sqlite>, hold_id: &str, decision: &str, instruction: Option<&str>, ) -> KernelResult<()>
PIP-001 §11d: Resolve a hold_request (approve or reject) within a transaction.
decision is “approve” or “reject” (PIP-001 §11d HoldResponse).
The DB status column uses the past-tense forms “approved”/“rejected”.
Sourcepub async fn consume_budget_in_tx(
&self,
tx: &mut Transaction<'_, Sqlite>,
envelope_id: &str,
amount: i64,
) -> KernelResult<i64>
pub async fn consume_budget_in_tx( &self, tx: &mut Transaction<'_, Sqlite>, envelope_id: &str, amount: i64, ) -> KernelResult<i64>
Consume budget from an envelope within a transaction. Returns the new total consumed amount.
Sourcepub async fn set_status_in_tx(
&self,
tx: &mut Transaction<'_, Sqlite>,
envelope_id: &str,
status: &EnvelopeStatus,
) -> KernelResult<()>
pub async fn set_status_in_tx( &self, tx: &mut Transaction<'_, Sqlite>, envelope_id: &str, status: &EnvelopeStatus, ) -> KernelResult<()>
Set envelope status within a transaction.
Sourcepub async fn set_status(
&self,
envelope_id: &str,
status: &EnvelopeStatus,
) -> KernelResult<()>
pub async fn set_status( &self, envelope_id: &str, status: &EnvelopeStatus, ) -> KernelResult<()>
Set envelope status without a transaction (convenience method).
Sourcepub async fn check_and_expire(&self, envelope_id: &str) -> KernelResult<bool>
pub async fn check_and_expire(&self, envelope_id: &str) -> KernelResult<bool>
Lazy expiry check: if envelope is time-expired, mark as expired and return true.
Sourcepub async fn update_checkpoint_tracking(
&self,
envelope_id: &str,
last_report_at: i64,
) -> KernelResult<()>
pub async fn update_checkpoint_tracking( &self, envelope_id: &str, last_report_at: i64, ) -> KernelResult<()>
Update checkpoint tracking fields.
Trait Implementations§
Source§impl Clone for EnvelopeStore
impl Clone for EnvelopeStore
Source§fn clone(&self) -> EnvelopeStore
fn clone(&self) -> EnvelopeStore
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for EnvelopeStore
impl !RefUnwindSafe for EnvelopeStore
impl Send for EnvelopeStore
impl Sync for EnvelopeStore
impl Unpin for EnvelopeStore
impl UnsafeUnpin for EnvelopeStore
impl !UnwindSafe for EnvelopeStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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