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 + Serialize + DeserializeOwned> RedisStorage<T>
impl<T: Job + Serialize + DeserializeOwned> RedisStorage<T>
sourcepub fn new(conn: ConnectionManager) -> Self
pub fn new(conn: ConnectionManager) -> Self
Start a new connection
sourcepub fn new_with_config(conn: ConnectionManager, config: Config) -> Self
pub fn new_with_config(conn: ConnectionManager, config: Config) -> Self
Start a new connection providing custom config
sourcepub fn get_connection(&self) -> ConnectionManager
pub fn get_connection(&self) -> ConnectionManager
Get current connection
source§impl<T> RedisStorage<T>
impl<T> RedisStorage<T>
sourcepub async fn retry(
&mut self,
worker_id: &WorkerId,
task_id: &TaskId
) -> Result<i32, RedisError>
pub async fn retry( &mut self, worker_id: &WorkerId, task_id: &TaskId ) -> Result<i32, RedisError>
Attempt to retry a job
sourcepub async fn kill(
&mut self,
worker_id: &WorkerId,
task_id: &TaskId
) -> Result<(), RedisError>
pub async fn kill( &mut self, worker_id: &WorkerId, task_id: &TaskId ) -> Result<(), RedisError>
Attempt to kill a job
sourcepub async fn enqueue_scheduled(
&mut self,
count: usize
) -> Result<usize, RedisError>
pub async fn enqueue_scheduled( &mut self, count: usize ) -> Result<usize, RedisError>
Required to add scheduled jobs to the active set
sourcepub async fn reenqueue_active(
&mut self,
job_ids: Vec<&TaskId>
) -> Result<(), RedisError>
pub async fn reenqueue_active( &mut self, job_ids: Vec<&TaskId> ) -> Result<(), RedisError>
Re-enqueue some jobs that might be abandoned.
sourcepub async fn reenqueue_orphaned(
&mut self,
count: usize,
dead_since: i64
) -> Result<usize, RedisError>
pub async fn reenqueue_orphaned( &mut self, count: usize, dead_since: i64 ) -> Result<usize, RedisError>
Re-enqueue some jobs that might be orphaned.
Trait Implementations§
source§impl<T: Sync> Ack<T> for RedisStorage<T>
impl<T: Sync> Ack<T> for RedisStorage<T>
§type Acknowledger = TaskId
type Acknowledger = TaskId
The data to fetch from context to allow acknowledgement
§type Error = RedisError
type Error = RedisError
The error returned by the ack
source§async fn ack(
&self,
worker_id: &WorkerId,
task_id: &Self::Acknowledger
) -> Result<(), RedisError>
async fn ack( &self, worker_id: &WorkerId, task_id: &Self::Acknowledger ) -> Result<(), RedisError>
Acknowledges successful processing of the given request
source§impl<T: Job + Serialize + DeserializeOwned + Sync + Send + Unpin + 'static> Backend<Request<T>> for RedisStorage<T>
impl<T: Job + Serialize + DeserializeOwned + Sync + Send + Unpin + 'static> Backend<Request<T>> for RedisStorage<T>
§type Stream = BackendStream<Pin<Box<dyn Stream<Item = Result<Option<Request<T>>, Error>> + Send>>>
type Stream = BackendStream<Pin<Box<dyn Stream<Item = Result<Option<Request<T>>, Error>> + Send>>>
The stream to be produced by the backend
§type Layer = AckLayer<RedisStorage<T>, T>
type Layer = AckLayer<RedisStorage<T>, T>
Returns the final decoration of layers
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>
impl<T> Storage for RedisStorage<T>
§type Error = RedisError
type Error = RedisError
The error produced by the storage
§type Identifier = TaskId
type Identifier = TaskId
Jobs must have Ids.
source§async fn push(&mut self, job: Self::Job) -> Result<TaskId, RedisError>
async fn push(&mut self, job: Self::Job) -> Result<TaskId, RedisError>
Pushes a job to a storage
source§async fn schedule(
&mut self,
job: Self::Job,
on: i64
) -> Result<TaskId, RedisError>
async fn schedule( &mut self, job: Self::Job, on: i64 ) -> Result<TaskId, RedisError>
Push a job into the scheduled set
source§async fn len(&self) -> Result<i64, RedisError>
async fn len(&self) -> Result<i64, RedisError>
Return the number of pending jobs from the queue
source§async fn fetch_by_id(
&self,
job_id: &TaskId
) -> Result<Option<Request<Self::Job>>, RedisError>
async fn fetch_by_id( &self, job_id: &TaskId ) -> Result<Option<Request<Self::Job>>, RedisError>
Fetch a job given an id
source§async fn reschedule(
&mut self,
job: Request<T>,
wait: Duration
) -> Result<(), RedisError>
async fn reschedule( &mut self, job: Request<T>, wait: Duration ) -> Result<(), RedisError>
Reschedule a job
Auto Trait Implementations§
impl<T> Freeze for RedisStorage<T>
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<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