pub trait Storage: Backend<Request<Self::Job>> {
type Job: Job;
type Error;
type Identifier;
// Required methods
fn push(
&mut self,
job: Self::Job
) -> impl Future<Output = Result<Self::Identifier, Self::Error>> + Send;
fn schedule(
&mut self,
job: Self::Job,
on: i64
) -> impl Future<Output = Result<Self::Identifier, Self::Error>> + Send;
fn len(&self) -> impl Future<Output = Result<i64, Self::Error>> + Send;
fn fetch_by_id(
&self,
job_id: &Self::Identifier
) -> impl Future<Output = Result<Option<Request<Self::Job>>, Self::Error>> + Send;
fn update(
&self,
job: Request<Self::Job>
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn reschedule(
&mut self,
job: Request<Self::Job>,
wait: Duration
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn is_empty(&self) -> impl Future<Output = Result<bool, Self::Error>> + Send;
fn vacuum(&self) -> impl Future<Output = Result<usize, Self::Error>> + Send;
}
Expand description
Required Associated Types§
sourcetype Identifier
type Identifier
Jobs must have Ids.
Required Methods§
sourcefn push(
&mut self,
job: Self::Job
) -> impl Future<Output = Result<Self::Identifier, Self::Error>> + Send
fn push( &mut self, job: Self::Job ) -> impl Future<Output = Result<Self::Identifier, Self::Error>> + Send
Pushes a job to a storage
sourcefn schedule(
&mut self,
job: Self::Job,
on: i64
) -> impl Future<Output = Result<Self::Identifier, Self::Error>> + Send
fn schedule( &mut self, job: Self::Job, on: i64 ) -> impl Future<Output = Result<Self::Identifier, Self::Error>> + Send
Push a job into the scheduled set
sourcefn len(&self) -> impl Future<Output = Result<i64, Self::Error>> + Send
fn len(&self) -> impl Future<Output = Result<i64, Self::Error>> + Send
Return the number of pending jobs from the queue
sourcefn fetch_by_id(
&self,
job_id: &Self::Identifier
) -> impl Future<Output = Result<Option<Request<Self::Job>>, Self::Error>> + Send
fn fetch_by_id( &self, job_id: &Self::Identifier ) -> impl Future<Output = Result<Option<Request<Self::Job>>, Self::Error>> + Send
Fetch a job given an id
sourcefn update(
&self,
job: Request<Self::Job>
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn update( &self, job: Request<Self::Job> ) -> impl Future<Output = Result<(), Self::Error>> + Send
Update a job details
sourcefn reschedule(
&mut self,
job: Request<Self::Job>,
wait: Duration
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn reschedule( &mut self, job: Request<Self::Job>, wait: Duration ) -> impl Future<Output = Result<(), Self::Error>> + Send
Reschedule a job
Object Safety§
This trait is not object safe.