Skip to main content

DynQueue

Trait DynQueue 

Source
pub trait DynQueue: Send + Sync {
    // Required methods
    fn enqueue<'a>(
        &'a self,
        queue: &'a str,
        payloads: Vec<Value>,
    ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>;
    fn enqueue_ordered<'a>(
        &'a self,
        queue: &'a str,
        jobs: Vec<(String, Value)>,
    ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>;
    fn claim<'a>(
        &'a self,
        queue: &'a str,
        limit: usize,
        lease: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, QueueError>> + Send + 'a>>;
    fn complete<'a>(
        &'a self,
        id: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>;
    fn retry<'a>(
        &'a self,
        id: &'a str,
        delay: Duration,
        error: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>;
    fn fail<'a>(
        &'a self,
        id: &'a str,
        error: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>;
    fn next_due<'a>(
        &'a self,
        queue: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Duration>, QueueError>> + Send + 'a>>;
}
Expand description

A Queue behind a pointer, for where the backend is chosen at run time: an application with a database per tenant hands Ojak a different queue for each request. Any Queue is one; shared makes a SharedQueue.

Required Methods§

Source

fn enqueue<'a>( &'a self, queue: &'a str, payloads: Vec<Value>, ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>

Source

fn enqueue_ordered<'a>( &'a self, queue: &'a str, jobs: Vec<(String, Value)>, ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>

Source

fn claim<'a>( &'a self, queue: &'a str, limit: usize, lease: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, QueueError>> + Send + 'a>>

Source

fn complete<'a>( &'a self, id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>

Source

fn retry<'a>( &'a self, id: &'a str, delay: Duration, error: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>

Source

fn fail<'a>( &'a self, id: &'a str, error: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>

Source

fn next_due<'a>( &'a self, queue: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<Duration>, QueueError>> + Send + 'a>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Q: Queue> DynQueue for Q