Skip to main content

SqlitePushOutbox

Struct SqlitePushOutbox 

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

A PushOutbox in an SQLite database; see the module documentation.

Implementations§

Source§

impl SqlitePushOutbox

Source

pub async fn new(url: &str) -> Result<SqlitePushOutbox, Error>

Opens (or creates) the database at url and its table.

§Errors

The database cannot be opened, or the table created.

Source

pub async fn from_pool(pool: Pool<Sqlite>) -> Result<SqlitePushOutbox, Error>

The outbox on pool, creating its table.

§Errors

The table cannot be created.

Source

pub fn with_cipher(self, cipher: Arc<dyn PushConfigCipher>) -> SqlitePushOutbox

Seals every event body with cipher, as the push-config stores seal configs (PushConfigCipher): an event can carry what the task store encrypts. A store that seals refuses a body it did not seal.

Trait Implementations§

Source§

impl Clone for SqlitePushOutbox

Source§

fn clone(&self) -> SqlitePushOutbox

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 SqlitePushOutbox

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PushOutbox for SqlitePushOutbox

Source§

fn is_process_local(&self) -> bool

Whether this outbox keeps its rows in this process alone, so that a delivery owed when the process stops is never made. Read more
Source§

fn record( &self, deliveries: Vec<NewDelivery>, per_webhook: usize, ) -> Pin<Box<dyn Future<Output = Result<usize, A2aError>> + Send + '_>>

Records deliveries, in order. A delivery whose delivery_id is already in the outbox is left as it is (recording the same delivery twice keeps one row, so a caller can record again what it is unsure was recorded); one that was delivered and removed is recorded again, and delivered again under the same id, which a receiver sees as a retry. At most per_webhook rows wait for one webhook of one task: past that, recording one drops the oldest of them that is not claimed and does not end a turn, or, when there is none, the new one unless it ends a turn (kept past the bound). Returns how many were dropped.
Source§

fn supports_reservations(&self) -> bool

Whether this outbox keeps reservations (reserve). One that does not (the default) is recorded in only after an event is stored, and a crash between the two loses that event’s deliveries.
Source§

fn reserve<'a>( &'a self, reservation: &'a str, log_seq: u64, deliveries: Vec<NewDelivery>, per_webhook: usize, hold: Duration, ) -> Pin<Box<dyn Future<Output = Result<usize, A2aError>> + Send + 'a>>

Phase one of recording an event’s deliveries before the event is stored (audit H14): deliveries, all of one event at position log_seq of its task’s log, are written unarmed. Read more
Source§

fn arm<'a>( &'a self, reservation: &'a str, ) -> Pin<Box<dyn Future<Output = Result<usize, A2aError>> + Send + 'a>>

Phase two, the event was stored: the rows of reservation become claimable. Returns how many rows the reservation has, armed by this call or already; 0 means there is nothing of it left (it was released, or settled by another replica as not stored, or already delivered), and the caller records the deliveries afresh. Read more
Source§

fn extend_hold<'a>( &'a self, reservation: &'a str, hold: Duration, ) -> Pin<Box<dyn Future<Output = Result<usize, A2aError>> + Send + 'a>>

Extends to hold from now the hold of reservation, if it is still held (not armed, not released): the heartbeat of a reserver that is still alive and whose event is still being written (adversarial review R3). Returns how many rows it extended; 0 means nothing of it is left to extend (it was settled by a replica whose worker saw the hold run out, or released). Read more
Source§

fn release<'a>( &'a self, reservation: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>

The event was not stored: removes the rows of reservation that are not armed. Armed rows, and a reservation that is gone, are left alone. Read more
Source§

fn held( &self, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Held>, A2aError>> + Send + '_>>

Up to limit reservations that are not armed and whose hold has run out, oldest first, one entry each however many webhooks it has rows for. Read more
Source§

fn held_for_task<'a>( &'a self, tenant: &'a str, caller: Option<&'a str>, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Held>, A2aError>> + Send + 'a>>

Every reservation of one task that is not armed, whether or not its hold has run out: for a caller that knows the reserver can write no more, such as the reaper once it holds the task’s turn claim (a store refuses a writer whose claim was taken over, so what the task store holds is final). Read more
Source§

fn supports_renewal(&self) -> bool

Whether this outbox renews leases (renew). With renewal a worker claims for a short lease and renews it while it works, so the rows of a worker that died are free after one short lease, not after the longest a delivery can take; without it (the default) the worker takes the long lease.
Source§

fn renew<'a>( &'a self, owner: &'a str, lease: Duration, ) -> Pin<Box<dyn Future<Output = Result<usize, A2aError>> + Send + 'a>>

Extends to lease from now every unexpired lease owner holds: the worker’s heartbeat. Returns how many rows it renewed. Read more
Source§

fn claim<'a>( &'a self, owner: &'a str, max: usize, lease: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<ClaimedDelivery>, A2aError>> + Send + 'a>>

Claims up to max rows that are due, not under another owner’s lease, and have no earlier unfinished row of the same tenant, caller, task and config, for owner, for lease. In record order.
Source§

fn complete( &self, seq: i64, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + '_>>

Removes row seq: delivered, refused for good, expired, or its config is gone. Harmless when it is already gone.
Source§

fn retry_after<'a>( &'a self, seq: i64, owner: &'a str, after: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>

Makes row seq due again after from now, one attempt more, and releases it, when owner still holds its lease; otherwise does nothing (another owner has it, and will finish it).
Source§

fn pending( &self, ) -> Pin<Box<dyn Future<Output = Result<usize, A2aError>> + Send + '_>>

How many rows wait, claimed or not, reserved or not: for a gauge.

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more