pub trait JobBackend: Send + Sync {
// Required methods
fn push<'life0, 'async_trait>(
&'life0 self,
job: JobRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<JobRequest>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn complete<'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 fail<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
job_id: &'life1 str,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Backend storage for jobs
Required Methods§
Sourcefn push<'life0, 'async_trait>(
&'life0 self,
job: JobRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn push<'life0, 'async_trait>(
&'life0 self,
job: JobRequest,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Push a new job to the queue
Sourcefn pop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<JobRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Option<JobRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Pop the next available job Should return None if no job is available or ready
Sourcefn complete<'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 complete<'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,
Mark a job as completed successfully
Sourcefn fail<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
job_id: &'life1 str,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn fail<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
job_id: &'life1 str,
error: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Mark a job as failed The manager will decide whether to retry (re-push) or move to DLQ