Struct apalis_sql::postgres::PostgresStorage
source · [−]pub struct PostgresStorage<T> { /* private fields */ }postgres only.Expand description
Represents a Storage that persists to Postgres
Implementations
Trait Implementations
sourceimpl<T> Clone for PostgresStorage<T>
impl<T> Clone for PostgresStorage<T>
sourceimpl<T: Debug> Debug for PostgresStorage<T>
impl<T: Debug> Debug for PostgresStorage<T>
sourceimpl<J: 'static + Job + Serialize + DeserializeOwned> JobStreamExt<J> for PostgresStorage<J>
impl<J: 'static + Job + Serialize + DeserializeOwned> JobStreamExt<J> for PostgresStorage<J>
sourcefn counts<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Counts, JobError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn counts<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Counts, JobError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Returns the counts of jobs in different states
sourcefn list_jobs<'life0, 'life1, 'async_trait>(
&'life0 mut self,
status: &'life1 JobState,
page: i32
) -> Pin<Box<dyn Future<Output = Result<Vec<JobRequest<J>>, JobError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn list_jobs<'life0, 'life1, 'async_trait>(
&'life0 mut self,
status: &'life1 JobState,
page: i32
) -> Pin<Box<dyn Future<Output = Result<Vec<JobRequest<J>>, JobError>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Fetch jobs persisted from storage
sourcefn list_workers<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Vec<JobStreamWorker>, JobError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn list_workers<'life0, 'async_trait>(
&'life0 mut self
) -> Pin<Box<dyn Future<Output = Result<Vec<JobStreamWorker>, JobError>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
List all Workers that are working on a Job Stream
sourceimpl<T> Storage for PostgresStorage<T> where
T: Job + Serialize + DeserializeOwned + Send + 'static + Unpin,
impl<T> Storage for PostgresStorage<T> where
T: Job + Serialize + DeserializeOwned + Send + 'static + Unpin,
sourcefn push<'life0, 'async_trait>(
&'life0 mut self,
job: Self::Output
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn push<'life0, 'async_trait>(
&'life0 mut self,
job: Self::Output
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
sourcefn retry<'life0, 'async_trait>(
&'life0 mut self,
worker_id: String,
job_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn retry<'life0, 'async_trait>(
&'life0 mut self,
worker_id: String,
job_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Puts the job instantly back into the queue Another [Worker] may consume
type Output = T
type Output = T
The type of job that can be persisted
sourcefn schedule<'life0, 'async_trait>(
&'life0 mut self,
job: Self::Output,
on: DateTime<Utc>
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn schedule<'life0, 'async_trait>(
&'life0 mut self,
job: Self::Output,
on: DateTime<Utc>
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Push a job into the scheduled set
sourcefn fetch_by_id<'life0, 'async_trait>(
&'life0 self,
job_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<Option<JobRequest<Self::Output>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn fetch_by_id<'life0, 'async_trait>(
&'life0 self,
job_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<Option<JobRequest<Self::Output>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Fetch a job given an id
sourcefn heartbeat<'life0, 'async_trait>(
&'life0 mut self,
pulse: StorageWorkerPulse
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn heartbeat<'life0, 'async_trait>(
&'life0 mut self,
pulse: StorageWorkerPulse
) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Used for scheduling jobs
sourcefn kill<'life0, 'async_trait>(
&'life0 mut self,
worker_id: String,
job_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn kill<'life0, 'async_trait>(
&'life0 mut self,
worker_id: String,
job_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Kill a job that returns [JobResult::Kill]
sourcefn consume(&mut self, worker_id: String, interval: Duration) -> JobStreamResult<T>
fn consume(&mut self, worker_id: String, interval: Duration) -> JobStreamResult<T>
Get the stream of jobs
sourcefn len<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn len<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = StorageResult<i64>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Return the number of pending jobs from the queue
sourcefn ack<'life0, 'async_trait>(
&'life0 mut self,
worker_id: String,
job_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn ack<'life0, 'async_trait>(
&'life0 mut self,
worker_id: String,
job_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Acknowledge a job which returns [JobResult::Success]
sourcefn reschedule<'life0, 'life1, 'async_trait>(
&'life0 mut self,
job: &'life1 JobRequest<T>,
wait: Duration
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Kill a job that returns [JobResult::Reschedule]
[JobResult::Reschedule]: crate::response::JobResult Read more
sourcefn update_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: String,
job: &'life1 JobRequest<Self::Output>
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn update_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
job_id: String,
job: &'life1 JobRequest<Self::Output>
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Update a job details
sourcefn keep_alive<'life0, 'async_trait, Service>(
&'life0 mut self,
worker_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
Service: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn keep_alive<'life0, 'async_trait, Service>(
&'life0 mut self,
worker_id: String
) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>> where
Service: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Called by a Worker to keep the storage alive and prevent jobs from being deemed as orphaned
Auto Trait Implementations
impl<T> !RefUnwindSafe for PostgresStorage<T>
impl<T> Send for PostgresStorage<T> where
T: Send,
impl<T> Sync for PostgresStorage<T> where
T: Sync,
impl<T> Unpin for PostgresStorage<T> where
T: Unpin,
impl<T> !UnwindSafe for PostgresStorage<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more