pub struct MailOutboxDbStore { /* private fields */ }Expand description
SeaORM-backed mail outbox store.
Implementations§
Source§impl MailOutboxDbStore
impl MailOutboxDbStore
Sourcepub const fn new(db: DatabaseConnection) -> Self
pub const fn new(db: DatabaseConnection) -> Self
Creates a mail outbox store from a SeaORM database connection.
Sourcepub async fn create(&self, request: MailOutboxCreate) -> Result<Model>
pub async fn create(&self, request: MailOutboxCreate) -> Result<Model>
Enqueues one pending mail outbox row.
Sourcepub async fn list_claimable(
&self,
now: DateTime<Utc>,
stale_before: DateTime<Utc>,
limit: u64,
) -> Result<Vec<Model>>
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.
Sourcepub async fn try_claim(
&self,
id: i64,
now: DateTime<Utc>,
stale_before: DateTime<Utc>,
) -> Result<bool>
pub async fn try_claim( &self, id: i64, now: DateTime<Utc>, stale_before: DateTime<Utc>, ) -> Result<bool>
Attempts to claim one row for processing.
Sourcepub async fn mark_sent(&self, id: i64, sent_at: DateTime<Utc>) -> Result<bool>
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.
Sourcepub async fn mark_retry(
&self,
id: i64,
attempt_count: i32,
next_attempt_at: DateTime<Utc>,
last_error: &str,
) -> Result<bool>
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.
Sourcepub async fn mark_failed(
&self,
id: i64,
attempt_count: i32,
failed_at: DateTime<Utc>,
last_error: &str,
) -> Result<bool>
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.
Sourcepub async fn count_active(&self) -> Result<u64>
pub async fn count_active(&self) -> Result<u64>
Counts pending or retry rows.
Sourcepub 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 = ()>,
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
impl Clone for MailOutboxDbStore
Source§fn clone(&self) -> MailOutboxDbStore
fn clone(&self) -> MailOutboxDbStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MailOutboxDbStore
impl !RefUnwindSafe for MailOutboxDbStore
impl Send for MailOutboxDbStore
impl Sync for MailOutboxDbStore
impl Unpin for MailOutboxDbStore
impl UnsafeUnpin for MailOutboxDbStore
impl !UnwindSafe for MailOutboxDbStore
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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