mas_storage::queue

Trait QueueJobRepositoryExt

source
pub trait QueueJobRepositoryExt: QueueJobRepository {
    // Required methods
    fn schedule_job<'life0, 'life1, 'life2, 'async_trait, J>(
        &'life0 mut self,
        rng: &'life1 mut (dyn RngCore + Send),
        clock: &'life2 dyn Clock,
        job: J,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where J: 'async_trait + InsertableJob,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn schedule_job_later<'life0, 'life1, 'life2, 'async_trait, J>(
        &'life0 mut self,
        rng: &'life1 mut (dyn RngCore + Send),
        clock: &'life2 dyn Clock,
        job: J,
        scheduled_at: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where J: 'async_trait + InsertableJob,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Extension trait for QueueJobRepository to help adding a job to the queue through the InsertableJob trait. This isn’t in the QueueJobRepository trait to keep it object safe.

Required Methods§

source

fn schedule_job<'life0, 'life1, 'life2, 'async_trait, J>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, job: J, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where J: 'async_trait + InsertableJob, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Schedule a job to be executed as soon as possible by a worker.

§Parameters
  • rng - The random number generator used to generate a new job ID
  • clock - The clock used to generate timestamps
  • job - The job to schedule
§Errors

Returns an error if the underlying repository fails.

source

fn schedule_job_later<'life0, 'life1, 'life2, 'async_trait, J>( &'life0 mut self, rng: &'life1 mut (dyn RngCore + Send), clock: &'life2 dyn Clock, job: J, scheduled_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where J: 'async_trait + InsertableJob, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Schedule a job to be executed at a later date by a worker.

§Parameters
  • rng - The random number generator used to generate a new job ID
  • clock - The clock used to generate timestamps
  • job - The job to schedule
  • scheduled_at - The date and time to schedule the job for
§Errors

Returns an error if the underlying repository fails.

Object Safety§

This trait is not object safe.

Implementors§