Skip to main content

DurableOutbox

Trait DurableOutbox 

Source
pub trait DurableOutbox: Send + Sync {
    // Required methods
    fn subscribe(&self) -> Receiver<NotificationId>;
    fn enqueue<'life0, 'async_trait>(
        &'life0 self,
        item: NewOutboxItem,
    ) -> Pin<Box<dyn Future<Output = Result<OutboxItem, NotifyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        id: &'life2 NotificationId,
    ) -> Pin<Box<dyn Future<Output = Result<OutboxItem, NotifyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        status: Option<NotificationStatus>,
        limit: usize,
        after: Option<&'life2 NotificationId>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxItem>, NotifyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn attempts<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        id: &'life2 NotificationId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AttemptEvent>, NotifyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn claim<'life0, 'life1, 'async_trait>(
        &'life0 self,
        worker_id: &'life1 str,
        lease_secs: i64,
        batch: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxItem>, NotifyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn mark_sent<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 NotificationId,
        lease_version: i64,
    ) -> Pin<Box<dyn Future<Output = Result<(), NotifyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn record_failure<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 NotificationId,
        lease_version: i64,
        class: DeliveryClass,
        delay: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<NotificationStatus, NotifyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn retry_dead_letter<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        id: &'life2 NotificationId,
    ) -> Pin<Box<dyn Future<Output = Result<OutboxItem, NotifyStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Store-owned durable queue and query contract.

Required Methods§

Source

fn subscribe(&self) -> Receiver<NotificationId>

Subscribes to in-process projection changes; consumers always read the durable row after receiving an id.

Source

fn enqueue<'life0, 'async_trait>( &'life0 self, item: NewOutboxItem, ) -> Pin<Box<dyn Future<Output = Result<OutboxItem, NotifyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Enqueues idempotently, rejecting payload mismatches.

Source

fn get<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, id: &'life2 NotificationId, ) -> Pin<Box<dyn Future<Output = Result<OutboxItem, NotifyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Reads one tenant-owned notification.

Source

fn list<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, status: Option<NotificationStatus>, limit: usize, after: Option<&'life2 NotificationId>, ) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxItem>, NotifyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Lists tenant-owned notifications after an optional cursor.

Source

fn attempts<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, id: &'life2 NotificationId, ) -> Pin<Box<dyn Future<Output = Result<Vec<AttemptEvent>, NotifyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Lists immutable attempt history.

Source

fn claim<'life0, 'life1, 'async_trait>( &'life0 self, worker_id: &'life1 str, lease_secs: i64, batch: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxItem>, NotifyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Claims due work across tenants from a BYPASSRLS worker connection.

Source

fn mark_sent<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 NotificationId, lease_version: i64, ) -> Pin<Box<dyn Future<Output = Result<(), NotifyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Records successful delivery under the current lease fence.

Source

fn record_failure<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 NotificationId, lease_version: i64, class: DeliveryClass, delay: Duration, ) -> Pin<Box<dyn Future<Output = Result<NotificationStatus, NotifyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Records a classified failure, scheduling retry or dead-lettering atomically.

Source

fn retry_dead_letter<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, id: &'life2 NotificationId, ) -> Pin<Box<dyn Future<Output = Result<OutboxItem, NotifyStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Requeues a tenant-owned dead letter after API authorization.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§