pub struct ScheduledTaskDbStore { /* private fields */ }Expand description
SeaORM-backed scheduled task store.
Implementations§
Source§impl ScheduledTaskDbStore
impl ScheduledTaskDbStore
Sourcepub const fn new(db: DatabaseConnection) -> Self
pub const fn new(db: DatabaseConnection) -> Self
Creates a scheduled task store from a SeaORM database connection.
Sourcepub async fn ensure_task(
&self,
entry: ScheduledTaskCatalogEntry<'_>,
) -> Result<Model>
pub async fn ensure_task( &self, entry: ScheduledTaskCatalogEntry<'_>, ) -> Result<Model>
Ensures one product scheduled task is present in the catalog.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn claim_due(
&self,
request: ScheduledTaskClaimRequest<'_>,
) -> Result<Option<ScheduledTaskClaim>>
pub async fn claim_due( &self, request: ScheduledTaskClaimRequest<'_>, ) -> Result<Option<ScheduledTaskClaim>>
Attempts to claim one due scheduled task firing.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn renew_claim(
&self,
renewal: ScheduledTaskClaimRenewal<'_>,
) -> Result<bool>
pub async fn renew_claim( &self, renewal: ScheduledTaskClaimRenewal<'_>, ) -> Result<bool>
Renews an owned claim while the task body is still running.
§Errors
Returns an error when the database operation fails.
Sourcepub async fn complete_claim(
&self,
completion: ScheduledTaskCompletion,
) -> Result<bool>
pub async fn complete_claim( &self, completion: ScheduledTaskCompletion, ) -> Result<bool>
Completes a claimed firing and advances the next due timestamp.
§Errors
Returns an error when the database operation fails.
Trait Implementations§
Source§impl Clone for ScheduledTaskDbStore
impl Clone for ScheduledTaskDbStore
Source§fn clone(&self) -> ScheduledTaskDbStore
fn clone(&self) -> ScheduledTaskDbStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ScheduledTaskStore for ScheduledTaskDbStore
impl ScheduledTaskStore for ScheduledTaskDbStore
Source§fn ensure_scheduled_task<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: ScheduledTaskCatalogEntry<'life1>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ensure_scheduled_task<'life0, 'life1, 'async_trait>(
&'life0 self,
entry: ScheduledTaskCatalogEntry<'life1>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Ensures one scheduled task is present in the catalog.
Source§fn claim_scheduled_task<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ScheduledTaskClaimRequest<'life1>,
) -> Pin<Box<dyn Future<Output = Result<Option<ScheduledTaskClaim>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn claim_scheduled_task<'life0, 'life1, 'async_trait>(
&'life0 self,
request: ScheduledTaskClaimRequest<'life1>,
) -> Pin<Box<dyn Future<Output = Result<Option<ScheduledTaskClaim>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Attempts to claim one due scheduled task firing.
Source§fn renew_scheduled_task_claim<'life0, 'life1, 'async_trait>(
&'life0 self,
renewal: ScheduledTaskClaimRenewal<'life1>,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn renew_scheduled_task_claim<'life0, 'life1, 'async_trait>(
&'life0 self,
renewal: ScheduledTaskClaimRenewal<'life1>,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Renews an owned claim while the task body is still running. Read more
Source§fn complete_scheduled_task<'life0, 'async_trait>(
&'life0 self,
completion: ScheduledTaskCompletion,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete_scheduled_task<'life0, 'async_trait>(
&'life0 self,
completion: ScheduledTaskCompletion,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Completes a claimed firing and advances the next due timestamp.
Auto Trait Implementations§
impl Freeze for ScheduledTaskDbStore
impl !RefUnwindSafe for ScheduledTaskDbStore
impl Send for ScheduledTaskDbStore
impl Sync for ScheduledTaskDbStore
impl Unpin for ScheduledTaskDbStore
impl !UnwindSafe for ScheduledTaskDbStore
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
Mutably borrows from an owned value. Read more
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>
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 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>
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