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: Job + Serialize + DeserializeOwned> SqliteStorage<T>
impl<T: Job + Serialize + DeserializeOwned> SqliteStorage<T>
sourcepub fn new(pool: SqlitePool) -> Self
pub fn new(pool: SqlitePool) -> Self
Construct a new Storage from a pool
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
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
Trait Implementations§
source§impl<T: Sync> Ack<T> for SqliteStorage<T>
impl<T: Sync> Ack<T> for SqliteStorage<T>
source§impl<T: Job + Serialize + DeserializeOwned + Sync + Send + Unpin + 'static> Backend<Request<T>> for SqliteStorage<T>
impl<T: Job + Serialize + DeserializeOwned + Sync + Send + Unpin + 'static> Backend<Request<T>> for SqliteStorage<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<SqliteStorage<T>, T>
type Layer = AckLayer<SqliteStorage<T>, T>
Returns the final decoration of layers
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(
&self,
job_id: &TaskId
) -> Result<Option<Request<Self::Job>>, Self::Error>
async fn fetch_by_id( &self, job_id: &TaskId ) -> Result<Option<Request<Self::Job>>, Self::Error>
Fetch a job given an id
source§async fn len(&self) -> Result<i64, Self::Error>
async fn len(&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(&self, job: Request<Self::Job>) -> Result<(), Self::Error>
async fn update(&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