pub trait Storage: Clone {
    type Output: Job;

Show 13 methods fn push<'life0, 'async_trait>(
        &'life0 mut self,
        job: Self::Output
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + 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<()>> + 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, 'async_trait>(
        &'life0 self,
        job_id: String
    ) -> Pin<Box<dyn Future<Output = StorageResult<Option<JobRequest<Self::Output>>>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn consume(
        &mut self,
        worker_id: String,
        interval: Duration
    ) -> JobStreamResult<Self::Output>; fn ack<'life0, 'async_trait>(
        &'life0 mut self,
        worker_id: String,
        job_id: String
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn retry<'life0, 'async_trait>(
        &'life0 mut self,
        worker_id: String,
        job_id: String
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn keep_alive<'life0, 'async_trait, Service>(
        &'life0 mut self,
        worker_id: String
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        Service: 'async_trait,
        Self: 'async_trait,
        'life0: 'async_trait
; fn kill<'life0, 'async_trait>(
        &'life0 mut self,
        worker_id: String,
        job_id: String
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait
; fn update_by_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        job_id: String,
        job: &'life1 JobRequest<Self::Output>
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        Self: 'async_trait,
        'life0: 'async_trait,
        'life1: '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
; fn reenqueue_active<'life0, 'async_trait>(
        &'life0 mut self,
        _job_ids: Vec<String>
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
    where
        Self: Send + 'async_trait,
        'life0: 'async_trait
, { ... }
}
Available on crate feature storage only.
Expand description

Represents a Storage that can be passed to a Builder

Required Associated Types§

The type of job that can be persisted

Required Methods§

Pushes a job to a storage

TODO: return id

Push a job into the scheduled set

Return the number of pending jobs from the queue

Fetch a job given an id

Get the stream of jobs

Acknowledge a job which returns [JobResult::Success]

Retry a job which returns [JobResult::Retry]

Called by a Worker to keep the storage alive and prevent jobs from being deemed as orphaned

Kill a job that returns [JobResult::Kill]

Update a job details

Used for scheduling jobs

Kill a job that returns [JobResult::Reschedule] [JobResult::Reschedule]: crate::response::JobResult

Provided Methods§

Used to recover jobs when a Worker shuts down.

Implementors§