pub trait QueueBackend: Send + Sync {
// Required methods
fn enqueue<'life0, 'async_trait>(
&'life0 self,
job: JobEntry,
) -> Pin<Box<dyn Future<Output = QueueResult<JobId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<Option<JobEntry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn complete<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
result: JobResult<()>,
) -> Pin<Box<dyn Future<Output = QueueResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
) -> Pin<Box<dyn Future<Output = QueueResult<Option<JobEntry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_jobs_by_state<'life0, 'async_trait>(
&'life0 self,
state: JobState,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = QueueResult<Vec<JobEntry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
) -> Pin<Box<dyn Future<Output = QueueResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<QueueStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn requeue_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
job: JobEntry,
) -> Pin<Box<dyn Future<Output = QueueResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn clear_jobs_by_state<'life0, 'async_trait>(
&'life0 self,
state: JobState,
) -> Pin<Box<dyn Future<Output = QueueResult<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Core queue backend trait that all queue implementations must implement
Required Methods§
Sourcefn enqueue<'life0, 'async_trait>(
&'life0 self,
job: JobEntry,
) -> Pin<Box<dyn Future<Output = QueueResult<JobId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn enqueue<'life0, 'async_trait>(
&'life0 self,
job: JobEntry,
) -> Pin<Box<dyn Future<Output = QueueResult<JobId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Enqueue a job
Sourcefn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<Option<JobEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dequeue<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<Option<JobEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dequeue the next available job
Sourcefn complete<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
result: JobResult<()>,
) -> Pin<Box<dyn Future<Output = QueueResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
result: JobResult<()>,
) -> Pin<Box<dyn Future<Output = QueueResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark a job as completed
Sourcefn get_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
) -> Pin<Box<dyn Future<Output = QueueResult<Option<JobEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
) -> Pin<Box<dyn Future<Output = QueueResult<Option<JobEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get job by ID
Sourcefn get_jobs_by_state<'life0, 'async_trait>(
&'life0 self,
state: JobState,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = QueueResult<Vec<JobEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_jobs_by_state<'life0, 'async_trait>(
&'life0 self,
state: JobState,
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = QueueResult<Vec<JobEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get jobs by state
Sourcefn remove_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
) -> Pin<Box<dyn Future<Output = QueueResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
) -> Pin<Box<dyn Future<Output = QueueResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove a job from the queue
Sourcefn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear all jobs from the queue
Sourcefn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<QueueStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = QueueResult<QueueStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get queue statistics
Provided Methods§
Sourcefn requeue_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
job: JobEntry,
) -> Pin<Box<dyn Future<Output = QueueResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn requeue_job<'life0, 'async_trait>(
&'life0 self,
job_id: JobId,
job: JobEntry,
) -> Pin<Box<dyn Future<Output = QueueResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Atomically requeue a job (remove old and enqueue new) Default implementation is non-atomic for backward compatibility
Sourcefn clear_jobs_by_state<'life0, 'async_trait>(
&'life0 self,
state: JobState,
) -> Pin<Box<dyn Future<Output = QueueResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear_jobs_by_state<'life0, 'async_trait>(
&'life0 self,
state: JobState,
) -> Pin<Box<dyn Future<Output = QueueResult<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Atomically clear all jobs in a specific state Default implementation is non-atomic for backward compatibility