Struct apalis_sql::sqlite::SqliteStorage
source · pub struct SqliteStorage<T> { /* private fields */ }Available on crate feature
sqlite only.Expand description
Represents a Storage that persists to Sqlite
Implementations§
source§impl SqliteStorage<()>
impl SqliteStorage<()>
source§impl<T: Serialize + DeserializeOwned> SqliteStorage<T>
impl<T: Serialize + DeserializeOwned> SqliteStorage<T>
sourcepub fn new(pool: SqlitePool) -> Self
pub fn new(pool: SqlitePool) -> Self
Create a new instance
sourcepub fn new_with_config(pool: SqlitePool, config: Config) -> Self
pub fn new_with_config(pool: SqlitePool, config: Config) -> Self
Create a new instance with a custom config
sourcepub async fn keep_alive_at<Service>(
&mut self,
worker_id: &WorkerId,
last_seen: i64,
) -> Result<(), Error>
pub async fn keep_alive_at<Service>( &mut self, worker_id: &WorkerId, last_seen: i64, ) -> Result<(), Error>
Keeps a storage notified that the worker is still alive manually
sourcepub fn pool(&self) -> &Pool<Sqlite>
pub fn pool(&self) -> &Pool<Sqlite>
Expose the pool for other functionality, eg custom migrations
sourcepub fn codec(&self) -> &SqliteCodec<T>
pub fn codec(&self) -> &SqliteCodec<T>
Expose the code used
source§impl<T> SqliteStorage<T>
impl<T> SqliteStorage<T>
sourcepub async fn retry(
&mut self,
worker_id: &WorkerId,
job_id: &TaskId,
) -> Result<(), Error>
pub async fn retry( &mut self, worker_id: &WorkerId, job_id: &TaskId, ) -> Result<(), Error>
Puts the job instantly back into the queue Another Worker may consume
sourcepub async fn kill(
&mut self,
worker_id: &WorkerId,
job_id: &TaskId,
) -> Result<(), Error>
pub async fn kill( &mut self, worker_id: &WorkerId, job_id: &TaskId, ) -> Result<(), Error>
Kill a job
sourcepub async fn reenqueue_failed(&mut self) -> Result<(), Error>
pub async fn reenqueue_failed(&mut self) -> Result<(), Error>
Add jobs that failed back to the queue if there are still remaining attemps
Trait Implementations§
source§impl<T: Serialize + DeserializeOwned + Sync + Send + Unpin + 'static> Backend<Request<T>> for SqliteStorage<T>
impl<T: Serialize + DeserializeOwned + Sync + Send + Unpin + 'static> Backend<Request<T>> for SqliteStorage<T>
source§impl<T> Clone for SqliteStorage<T>
impl<T> Clone for SqliteStorage<T>
source§impl<T> Debug for SqliteStorage<T>
impl<T> Debug for SqliteStorage<T>
source§impl<T> Storage for SqliteStorage<T>
impl<T> Storage for SqliteStorage<T>
§type Identifier = TaskId
type Identifier = TaskId
Jobs must have Ids.
source§async fn push(&mut self, job: Self::Job) -> Result<TaskId, Self::Error>
async fn push(&mut self, job: Self::Job) -> Result<TaskId, Self::Error>
Pushes a job to a storage
source§async fn schedule(
&mut self,
job: Self::Job,
on: i64,
) -> Result<TaskId, Self::Error>
async fn schedule( &mut self, job: Self::Job, on: i64, ) -> Result<TaskId, Self::Error>
Push a job into the scheduled set
source§async fn fetch_by_id(
&mut self,
job_id: &TaskId,
) -> Result<Option<Request<Self::Job>>, Self::Error>
async fn fetch_by_id( &mut self, job_id: &TaskId, ) -> Result<Option<Request<Self::Job>>, Self::Error>
Fetch a job given an id
source§async fn len(&mut self) -> Result<i64, Self::Error>
async fn len(&mut self) -> Result<i64, Self::Error>
Return the number of pending jobs from the queue
source§async fn reschedule(
&mut self,
job: Request<T>,
wait: Duration,
) -> Result<(), Self::Error>
async fn reschedule( &mut self, job: Request<T>, wait: Duration, ) -> Result<(), Self::Error>
Reschedule a job
source§async fn update(&mut self, job: Request<Self::Job>) -> Result<(), Self::Error>
async fn update(&mut self, job: Request<Self::Job>) -> Result<(), Self::Error>
Update a job details
Auto Trait Implementations§
impl<T> Freeze for SqliteStorage<T>
impl<T> !RefUnwindSafe for SqliteStorage<T>
impl<T> Send for SqliteStorage<T>where
T: Send,
impl<T> Sync for SqliteStorage<T>where
T: Sync,
impl<T> Unpin for SqliteStorage<T>where
T: Unpin,
impl<T> !UnwindSafe for SqliteStorage<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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more