Skip to main content

MailOutboxDbStore

Struct MailOutboxDbStore 

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

SeaORM-backed mail outbox store.

Implementations§

Source§

impl MailOutboxDbStore

Source

pub const fn new(db: DatabaseConnection) -> Self

Creates a mail outbox store from a SeaORM database connection.

Source

pub async fn create(&self, request: MailOutboxCreate) -> Result<Model>

Enqueues one pending mail outbox row.

Source

pub async fn list_claimable( &self, now: DateTime<Utc>, stale_before: DateTime<Utc>, limit: u64, ) -> Result<Vec<Model>>

Lists rows that are due or stale enough to be reclaimed.

Source

pub async fn try_claim( &self, id: i64, now: DateTime<Utc>, stale_before: DateTime<Utc>, ) -> Result<bool>

Attempts to claim one row for processing.

Source

pub async fn mark_sent(&self, id: i64, sent_at: DateTime<Utc>) -> Result<bool>

Marks a processing row as sent and clears its sensitive payload.

Source

pub async fn mark_retry( &self, id: i64, attempt_count: i32, next_attempt_at: DateTime<Utc>, last_error: &str, ) -> Result<bool>

Marks a processing row for retry.

Source

pub async fn mark_failed( &self, id: i64, attempt_count: i32, failed_at: DateTime<Utc>, last_error: &str, ) -> Result<bool>

Marks a processing row as permanently failed and clears its sensitive payload.

Source

pub async fn count_active(&self) -> Result<u64>

Counts pending or retry rows.

Source

pub async fn dispatch_due<E, Deliver, DeliverFut, OnSent, OnSentFut, OnFailed, OnFailedFut>( &self, config: &MailOutboxDispatchConfig, deliver: Deliver, on_sent: OnSent, on_failed: OnFailed, ) -> Result<DispatchStats, E>
where E: From<DbError> + Display, Deliver: FnMut(Model) -> DeliverFut, DeliverFut: Future<Output = Result<String, E>>, OnSent: FnMut(MailOutboxDispatchContext, i32, String) -> OnSentFut, OnSentFut: Future<Output = ()>, OnFailed: FnMut(MailOutboxDispatchContext, i32, String) -> OnFailedFut, OnFailedFut: Future<Output = ()>,

Runs one shared dispatch pass using the standard database-backed outbox mechanics.

Forge owns list/claim/mark/retry/failure persistence for the shared mail_outbox table. Products only provide rendering/delivery and audit hooks, which keeps every Aster service on the same state machine without copying payload-heavy rows across persistence callbacks.

Trait Implementations§

Source§

impl Clone for MailOutboxDbStore

Source§

fn clone(&self) -> MailOutboxDbStore

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

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

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