pub struct MysqlStorage<T, C = JsonCodec<Value>>where
C: Codec,{ /* private fields */ }
Available on crate feature
mysql
only.Expand description
Represents a Storage that persists to MySQL
Implementations§
Source§impl<T> MysqlStorage<T>where
T: Serialize + DeserializeOwned,
impl<T> MysqlStorage<T>where
T: Serialize + DeserializeOwned,
Trait Implementations§
Source§impl<T, Res, C> Ack<T, Res, C> for MysqlStorage<T, C>
impl<T, Res, C> Ack<T, Res, C> for MysqlStorage<T, C>
Source§impl<Req, C> Backend<Request<Req, SqlContext>> for MysqlStorage<Req, C>
impl<Req, C> Backend<Request<Req, SqlContext>> for MysqlStorage<Req, C>
Source§type Stream = BackendStream<Pin<Box<dyn Stream<Item = Result<Option<Request<Req, SqlContext>>, Error>> + Send>>>
type Stream = BackendStream<Pin<Box<dyn Stream<Item = Result<Option<Request<Req, SqlContext>>, Error>> + Send>>>
The stream to be produced by the backend
Source§type Layer = AckLayer<MysqlStorage<Req, C>, Req, SqlContext, C>
type Layer = AckLayer<MysqlStorage<Req, C>, Req, SqlContext, C>
Returns the final decoration of layers
Source§impl<J: 'static + Serialize + DeserializeOwned + Unpin + Send + Sync> BackendExpose<J> for MysqlStorage<J>
impl<J: 'static + Serialize + DeserializeOwned + Unpin + Send + Sync> BackendExpose<J> for MysqlStorage<J>
Source§async fn stats(&self) -> Result<Stat, Self::Error>
async fn stats(&self) -> Result<Stat, Self::Error>
Returns the counts of jobs in different states
Source§async fn list_jobs(
&self,
status: &State,
page: i32,
) -> Result<Vec<Self::Request>, Self::Error>
async fn list_jobs( &self, status: &State, page: i32, ) -> Result<Vec<Self::Request>, Self::Error>
Fetch jobs persisted in a backend
Source§async fn list_workers(&self) -> Result<Vec<Worker<WorkerState>>, Self::Error>
async fn list_workers(&self) -> Result<Vec<Worker<WorkerState>>, Self::Error>
List all Workers that are working on a backend
Source§impl<T, C> Clone for MysqlStorage<T, C>where
C: Codec,
impl<T, C> Clone for MysqlStorage<T, C>where
C: Codec,
Source§impl<T, C> Debug for MysqlStorage<T, C>
impl<T, C> Debug for MysqlStorage<T, C>
Source§impl<T, C> Storage for MysqlStorage<T, C>
impl<T, C> Storage for MysqlStorage<T, C>
Source§type Context = SqlContext
type Context = SqlContext
This is the type that storages store as the metadata related to a job
Source§async fn push_request(
&mut self,
job: Request<Self::Job, SqlContext>,
) -> Result<Parts<SqlContext>, Error>
async fn push_request( &mut self, job: Request<Self::Job, SqlContext>, ) -> Result<Parts<SqlContext>, Error>
Pushes a constructed request to a storage
Source§async fn push_raw_request(
&mut self,
job: Request<Self::Compact, SqlContext>,
) -> Result<Parts<SqlContext>, Error>
async fn push_raw_request( &mut self, job: Request<Self::Compact, SqlContext>, ) -> Result<Parts<SqlContext>, Error>
Pushes a constructed request to a storage
Source§async fn schedule_request(
&mut self,
req: Request<Self::Job, SqlContext>,
on: i64,
) -> Result<Parts<Self::Context>, Error>
async fn schedule_request( &mut self, req: Request<Self::Job, SqlContext>, on: i64, ) -> Result<Parts<Self::Context>, Error>
Push a request into the scheduled set
Source§async fn fetch_by_id(
&mut self,
job_id: &TaskId,
) -> Result<Option<Request<Self::Job, SqlContext>>, Error>
async fn fetch_by_id( &mut self, job_id: &TaskId, ) -> Result<Option<Request<Self::Job, SqlContext>>, Error>
Fetch a job given an id
Source§async fn len(&mut self) -> Result<i64, Error>
async fn len(&mut self) -> Result<i64, Error>
Return the number of pending jobs from the queue
Source§async fn reschedule(
&mut self,
job: Request<T, SqlContext>,
wait: Duration,
) -> Result<(), Error>
async fn reschedule( &mut self, job: Request<T, SqlContext>, wait: Duration, ) -> Result<(), Error>
Reschedule a job
Source§async fn update(
&mut self,
job: Request<Self::Job, SqlContext>,
) -> Result<(), Error>
async fn update( &mut self, job: Request<Self::Job, SqlContext>, ) -> Result<(), Error>
Update a job details
Source§async fn is_empty(&mut self) -> Result<bool, Self::Error>
async fn is_empty(&mut self) -> Result<bool, Self::Error>
Returns true if there is no jobs in the storage
Source§async fn vacuum(&mut self) -> Result<usize, Error>
async fn vacuum(&mut self) -> Result<usize, Error>
Vacuum the storage, removes done and killed jobs
Auto Trait Implementations§
impl<T, C> Freeze for MysqlStorage<T, C>
impl<T, C = JsonCodec<Value>> !RefUnwindSafe for MysqlStorage<T, C>
impl<T, C> Send for MysqlStorage<T, C>
impl<T, C> Sync for MysqlStorage<T, C>
impl<T, C> Unpin for MysqlStorage<T, C>
impl<T, C = JsonCodec<Value>> !UnwindSafe for MysqlStorage<T, C>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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