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§
Sourcefn enqueue<'a>(
&'a self,
queue: &'a str,
payloads: Vec<Value>,
) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>
fn enqueue<'a>( &'a self, queue: &'a str, payloads: Vec<Value>, ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>
Sourcefn enqueue_ordered<'a>(
&'a self,
queue: &'a str,
jobs: Vec<(String, 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>>
Sourcefn claim<'a>(
&'a self,
queue: &'a str,
limit: usize,
lease: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<Job>, 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>>
Sourcefn complete<'a>(
&'a self,
id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>
fn complete<'a>( &'a self, id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), QueueError>> + Send + 'a>>
Sourcefn retry<'a>(
&'a self,
id: &'a str,
delay: Duration,
error: &'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>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".