Trait apalis_core::storage::Storage
source · pub trait Storage: Clone {
type Output: Job;
Show 13 methods
// Required methods
fn push<'life0, 'async_trait>(
&'life0 mut self,
job: Self::Output
) -> Pin<Box<dyn Future<Output = StorageResult<JobId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn schedule<'life0, 'async_trait>(
&'life0 mut self,
job: Self::Output,
on: DateTime<Utc>
) -> Pin<Box<dyn Future<Output = StorageResult<JobId>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn len<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fetch_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: &'life1 JobId
) -> Pin<Box<dyn Future<Output = StorageResult<Option<JobRequest<Self::Output>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn consume(
&mut self,
worker_id: &WorkerId,
interval: Duration,
buffer_size: usize
) -> JobStreamResult<Self::Output>;
fn ack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
worker_id: &'life1 WorkerId,
job_id: &'life2 JobId
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn retry<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
worker_id: &'life1 WorkerId,
job_id: &'life2 JobId
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn keep_alive<'life0, 'life1, 'async_trait, Service>(
&'life0 mut self,
worker_id: &'life1 WorkerId
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Service: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn kill<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
worker_id: &'life1 WorkerId,
job_id: &'life2 JobId
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn update_by_id<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
job_id: &'life1 JobId,
job: &'life2 JobRequest<Self::Output>
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn heartbeat<'life0, 'async_trait>(
&'life0 mut self,
pulse: StorageWorkerPulse
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn reschedule<'life0, 'life1, 'async_trait>(
&'life0 mut self,
job: &'life1 JobRequest<Self::Output>,
wait: Duration
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn reenqueue_active<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_job_ids: Vec<&'life1 JobId>
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Available on crate feature
storage only.Required Associated Types§
Required Methods§
sourcefn push<'life0, 'async_trait>(
&'life0 mut self,
job: Self::Output
) -> Pin<Box<dyn Future<Output = StorageResult<JobId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn push<'life0, 'async_trait>( &'life0 mut self, job: Self::Output ) -> Pin<Box<dyn Future<Output = StorageResult<JobId>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Pushes a job to a storage
sourcefn schedule<'life0, 'async_trait>(
&'life0 mut self,
job: Self::Output,
on: DateTime<Utc>
) -> Pin<Box<dyn Future<Output = StorageResult<JobId>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn schedule<'life0, 'async_trait>( &'life0 mut self, job: Self::Output, on: DateTime<Utc> ) -> Pin<Box<dyn Future<Output = StorageResult<JobId>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Push a job into the scheduled set
sourcefn len<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn len<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Return the number of pending jobs from the queue
sourcefn fetch_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: &'life1 JobId
) -> Pin<Box<dyn Future<Output = StorageResult<Option<JobRequest<Self::Output>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn fetch_by_id<'life0, 'life1, 'async_trait>( &'life0 self, job_id: &'life1 JobId ) -> Pin<Box<dyn Future<Output = StorageResult<Option<JobRequest<Self::Output>>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Fetch a job given an id
sourcefn consume(
&mut self,
worker_id: &WorkerId,
interval: Duration,
buffer_size: usize
) -> JobStreamResult<Self::Output>
fn consume( &mut self, worker_id: &WorkerId, interval: Duration, buffer_size: usize ) -> JobStreamResult<Self::Output>
Get the stream of jobs
sourcefn ack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
worker_id: &'life1 WorkerId,
job_id: &'life2 JobId
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn ack<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, worker_id: &'life1 WorkerId, job_id: &'life2 JobId ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Acknowledge a job which returns Ok
sourcefn retry<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
worker_id: &'life1 WorkerId,
job_id: &'life2 JobId
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn retry<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, worker_id: &'life1 WorkerId, job_id: &'life2 JobId ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Retry a job
sourcefn keep_alive<'life0, 'life1, 'async_trait, Service>(
&'life0 mut self,
worker_id: &'life1 WorkerId
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Service: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn keep_alive<'life0, 'life1, 'async_trait, Service>( &'life0 mut self, worker_id: &'life1 WorkerId ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where Service: 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Called by a Worker to keep the storage alive and prevent jobs from being deemed as orphaned
sourcefn kill<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
worker_id: &'life1 WorkerId,
job_id: &'life2 JobId
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn kill<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, worker_id: &'life1 WorkerId, job_id: &'life2 JobId ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Kill a job
sourcefn update_by_id<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
job_id: &'life1 JobId,
job: &'life2 JobRequest<Self::Output>
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update_by_id<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, job_id: &'life1 JobId, job: &'life2 JobRequest<Self::Output> ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,
Update a job details
sourcefn heartbeat<'life0, 'async_trait>(
&'life0 mut self,
pulse: StorageWorkerPulse
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn heartbeat<'life0, 'async_trait>( &'life0 mut self, pulse: StorageWorkerPulse ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Used for scheduling jobs
sourcefn reschedule<'life0, 'life1, 'async_trait>(
&'life0 mut self,
job: &'life1 JobRequest<Self::Output>,
wait: Duration
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reschedule<'life0, 'life1, 'async_trait>( &'life0 mut self, job: &'life1 JobRequest<Self::Output>, wait: Duration ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Reschedule a job
Provided Methods§
sourcefn reenqueue_active<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_job_ids: Vec<&'life1 JobId>
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn reenqueue_active<'life0, 'life1, 'async_trait>( &'life0 mut self, _job_ids: Vec<&'life1 JobId> ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where Self: Send + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Used to recover jobs when a Worker shuts down.
Object Safety§
This trait is not object safe.