Struct apalis::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> SqliteStorage<T>
impl<T> SqliteStorage<T>
sourcepub fn new(pool: Pool<Sqlite>) -> SqliteStorage<T>
pub fn new(pool: Pool<Sqlite>) -> SqliteStorage<T>
Construct a new Storage from a pool
sourcepub fn new_with_config(pool: Pool<Sqlite>, config: Config) -> SqliteStorage<T>
pub fn new_with_config(pool: Pool<Sqlite>, config: Config) -> SqliteStorage<T>
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> Ack<T> for SqliteStorage<T>where
T: Sync,
impl<T> Ack<T> for SqliteStorage<T>where
T: Sync,
§type Acknowledger = TaskId
type Acknowledger = TaskId
The data to fetch from context to allow acknowledgement
source§async fn ack(
&self,
worker_id: &WorkerId,
task_id: &<SqliteStorage<T> as Ack<T>>::Acknowledger
) -> Result<(), Error>
async fn ack( &self, worker_id: &WorkerId, task_id: &<SqliteStorage<T> as Ack<T>>::Acknowledger ) -> Result<(), Error>
Acknowledges successful processing of the given request
source§impl<T> Backend<Request<T>> for SqliteStorage<T>
impl<T> 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§fn common_layer(
&self,
worker_id: WorkerId
) -> <SqliteStorage<T> as Backend<Request<T>>>::Layer
fn common_layer( &self, worker_id: WorkerId ) -> <SqliteStorage<T> as Backend<Request<T>>>::Layer
Allows the backend to decorate the service with Layer
source§impl<T> Clone for SqliteStorage<T>
impl<T> Clone for SqliteStorage<T>
source§fn clone(&self) -> SqliteStorage<T>
fn clone(&self) -> SqliteStorage<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§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: <SqliteStorage<T> as Storage>::Job
) -> Result<TaskId, <SqliteStorage<T> as Storage>::Error>
async fn push( &mut self, job: <SqliteStorage<T> as Storage>::Job ) -> Result<TaskId, <SqliteStorage<T> as Storage>::Error>
Pushes a job to a storage
source§async fn schedule(
&mut self,
job: <SqliteStorage<T> as Storage>::Job,
on: i64
) -> Result<TaskId, <SqliteStorage<T> as Storage>::Error>
async fn schedule( &mut self, job: <SqliteStorage<T> as Storage>::Job, on: i64 ) -> Result<TaskId, <SqliteStorage<T> as Storage>::Error>
Push a job into the scheduled set
source§async fn fetch_by_id(
&self,
job_id: &TaskId
) -> Result<Option<Request<<SqliteStorage<T> as Storage>::Job>>, <SqliteStorage<T> as Storage>::Error>
async fn fetch_by_id( &self, job_id: &TaskId ) -> Result<Option<Request<<SqliteStorage<T> as Storage>::Job>>, <SqliteStorage<T> as Storage>::Error>
Fetch a job given an id
source§async fn len(&self) -> Result<i64, <SqliteStorage<T> as Storage>::Error>
async fn len(&self) -> Result<i64, <SqliteStorage<T> as Storage>::Error>
Return the number of pending jobs from the queue
source§async fn reschedule(
&mut self,
job: Request<T>,
wait: Duration
) -> Result<(), <SqliteStorage<T> as Storage>::Error>
async fn reschedule( &mut self, job: Request<T>, wait: Duration ) -> Result<(), <SqliteStorage<T> as Storage>::Error>
Reschedule a job
source§async fn update(
&self,
job: Request<<SqliteStorage<T> as Storage>::Job>
) -> Result<(), <SqliteStorage<T> as Storage>::Error>
async fn update( &self, job: Request<<SqliteStorage<T> as Storage>::Job> ) -> Result<(), <SqliteStorage<T> as Storage>::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> 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