pub trait Storage: Backend<Request<Self::Job, Self::Context>> {
type Job;
type Error;
type Context: Default;
type Compact;
// Required methods
fn push_request(
&mut self,
req: Request<Self::Job, Self::Context>,
) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send;
fn push_raw_request(
&mut self,
req: Request<Self::Compact, Self::Context>,
) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send;
fn schedule_request(
&mut self,
request: Request<Self::Job, Self::Context>,
on: i64,
) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send;
fn len(&mut self) -> impl Future<Output = Result<i64, Self::Error>> + Send;
fn fetch_by_id(
&mut self,
job_id: &TaskId,
) -> impl Future<Output = Result<Option<Request<Self::Job, Self::Context>>, Self::Error>> + Send;
fn update(
&mut self,
job: Request<Self::Job, Self::Context>,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn reschedule(
&mut self,
job: Request<Self::Job, Self::Context>,
wait: Duration,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn is_empty(
&mut self,
) -> impl Future<Output = Result<bool, Self::Error>> + Send;
fn vacuum(
&mut self,
) -> impl Future<Output = Result<usize, Self::Error>> + Send;
// Provided methods
fn push(
&mut self,
job: Self::Job,
) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send { ... }
fn schedule(
&mut self,
job: Self::Job,
on: i64,
) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send { ... }
}
Expand description
Represents a Storage that can persist a request.
Required Associated Types§
Required Methods§
Sourcefn push_request(
&mut self,
req: Request<Self::Job, Self::Context>,
) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send
fn push_request( &mut self, req: Request<Self::Job, Self::Context>, ) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send
Pushes a constructed request to a storage
Sourcefn push_raw_request(
&mut self,
req: Request<Self::Compact, Self::Context>,
) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send
fn push_raw_request( &mut self, req: Request<Self::Compact, Self::Context>, ) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send
Pushes a constructed request to a storage
Sourcefn schedule_request(
&mut self,
request: Request<Self::Job, Self::Context>,
on: i64,
) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send
fn schedule_request( &mut self, request: Request<Self::Job, Self::Context>, on: i64, ) -> impl Future<Output = Result<Parts<Self::Context>, Self::Error>> + Send
Push a request into the scheduled set
Sourcefn len(&mut self) -> impl Future<Output = Result<i64, Self::Error>> + Send
fn len(&mut self) -> impl Future<Output = Result<i64, Self::Error>> + Send
Return the number of pending jobs from the queue
Sourcefn fetch_by_id(
&mut self,
job_id: &TaskId,
) -> impl Future<Output = Result<Option<Request<Self::Job, Self::Context>>, Self::Error>> + Send
fn fetch_by_id( &mut self, job_id: &TaskId, ) -> impl Future<Output = Result<Option<Request<Self::Job, Self::Context>>, Self::Error>> + Send
Fetch a job given an id
Sourcefn update(
&mut self,
job: Request<Self::Job, Self::Context>,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn update( &mut self, job: Request<Self::Job, Self::Context>, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Update a job details
Sourcefn reschedule(
&mut self,
job: Request<Self::Job, Self::Context>,
wait: Duration,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn reschedule( &mut self, job: Request<Self::Job, Self::Context>, wait: Duration, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Reschedule a job
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.