Trait QueueDriver

Source
pub trait QueueDriver: Send + Sync {
    type Job: Send + Sync + Serialize + for<'de> Deserialize<'de>;

    // Required methods
    fn push<'life0, 'life1, 'async_trait>(
        &'life0 self,
        queue: &'life1 str,
        job: Self::Job,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn pop<'life0, 'life1, 'async_trait>(
        &'life0 self,
        queue: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<(String, Self::Job)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn ack<'life0, 'life1, 'async_trait>(
        &'life0 self,
        job_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn reject<'life0, 'life1, 'async_trait>(
        &'life0 self,
        job_id: &'life1 str,
        requeue: bool,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn size<'life0, 'life1, 'async_trait>(
        &'life0 self,
        queue: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn purge<'life0, 'life1, 'async_trait>(
        &'life0 self,
        queue: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for queue drivers

Required Associated Types§

Source

type Job: Send + Sync + Serialize + for<'de> Deserialize<'de>

Job data type

Required Methods§

Source

fn push<'life0, 'life1, 'async_trait>( &'life0 self, queue: &'life1 str, job: Self::Job, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Pushes a job to the queue

Source

fn pop<'life0, 'life1, 'async_trait>( &'life0 self, queue: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<(String, Self::Job)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Pops a job from the queue

Source

fn ack<'life0, 'life1, 'async_trait>( &'life0 self, job_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Acknowledges job completion

Source

fn reject<'life0, 'life1, 'async_trait>( &'life0 self, job_id: &'life1 str, requeue: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Rejects a job (puts it back in queue or dead letter)

Source

fn size<'life0, 'life1, 'async_trait>( &'life0 self, queue: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets queue size

Source

fn purge<'life0, 'life1, 'async_trait>( &'life0 self, queue: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Purges a queue

Implementors§