Struct apalis_redis::RedisStorage
source · pub struct RedisStorage<T> { /* private fields */ }Expand description
Represents a Storage that uses Redis for storage.
Implementations§
source§impl<T: Job> RedisStorage<T>
impl<T: Job> RedisStorage<T>
sourcepub fn new(conn: ConnectionManager) -> Self
pub fn new(conn: ConnectionManager) -> Self
Start a new connection
sourcepub async fn connect<S: IntoConnectionInfo>(
redis: S
) -> Result<Self, RedisError>
pub async fn connect<S: IntoConnectionInfo>( redis: S ) -> Result<Self, RedisError>
Connect to a redis url
sourcepub fn get_connection(&self) -> ConnectionManager
pub fn get_connection(&self) -> ConnectionManager
Get current connection
Trait Implementations§
source§impl<T> Clone for RedisStorage<T>
impl<T> Clone for RedisStorage<T>
source§impl<T> Debug for RedisStorage<T>
impl<T> Debug for RedisStorage<T>
source§impl<T> Storage for RedisStorage<T>where
T: Serialize + DeserializeOwned + Send + 'static + Unpin + Job + Sync,
impl<T> Storage for RedisStorage<T>where T: Serialize + DeserializeOwned + Send + 'static + Unpin + Job + Sync,
source§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 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
source§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 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
source§fn consume(
&mut self,
worker_id: &WorkerId,
interval: Duration,
buffer_size: usize
) -> JobStreamResult<T>
fn consume( &mut self, worker_id: &WorkerId, interval: Duration, buffer_size: usize ) -> JobStreamResult<T>
Get the stream of jobs
source§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 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
source§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 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
source§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 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
source§fn update_by_id<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
job_id: &'life1 JobId,
job: &'life2 JobRequest<T>
) -> 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<T> ) -> 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
source§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 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
source§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 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
source§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 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
source§fn heartbeat<'life0, 'async_trait>(
&'life0 mut self,
beat: 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, beat: StorageWorkerPulse ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Used for scheduling jobs
source§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: '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: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Used to recover jobs when a Worker shuts down.
source§fn reschedule<'life0, 'life1, 'async_trait>(
&'life0 mut self,
job: &'life1 JobRequest<T>,
_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<T>, _wait: Duration ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Reschedule a job
Auto Trait Implementations§
impl<T> !RefUnwindSafe for RedisStorage<T>
impl<T> Send for RedisStorage<T>where T: Send,
impl<T> Sync for RedisStorage<T>where T: Sync,
impl<T> Unpin for RedisStorage<T>where T: Unpin,
impl<T> !UnwindSafe for RedisStorage<T>
Blanket Implementations§
source§impl<J, S> Ack<J> for Swhere
S: Storage<Output = J> + Send + Sync,
J: Send + Sync,
impl<J, S> Ack<J> for Swhere S: Storage<Output = J> + Send + Sync, J: Send + Sync,
§type Acknowledger = JobId
type Acknowledger = JobId
The data to fetch from context to allow acknowledgement
source§fn ack<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
worker_id: &'life1 WorkerId,
job_id: &'life2 JobId
) -> Pin<Box<dyn Future<Output = Result<(), AckError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
S: 'async_trait,
fn ack<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, worker_id: &'life1 WorkerId, job_id: &'life2 JobId ) -> Pin<Box<dyn Future<Output = Result<(), AckError>> + Send + 'async_trait>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, S: 'async_trait,
Acknowledges successful processing of the given request
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more