pub struct PostgresStorage<T, C = JsonCodec<Value>>where
C: Codec,{ /* private fields */ }Available on crate feature
postgres only.Expand description
Represents a Storage that persists to Postgres
Implementations§
source§impl PostgresStorage<()>
impl PostgresStorage<()>
source§impl<T> PostgresStorage<T>
impl<T> PostgresStorage<T>
source§impl<T, C: Codec> PostgresStorage<T, C>
impl<T, C: Codec> PostgresStorage<T, C>
sourcepub fn codec(&self) -> &PhantomData<C>
pub fn codec(&self) -> &PhantomData<C>
Expose the codec
source§impl<T, C: Codec> PostgresStorage<T, C>
impl<T, C: Codec> PostgresStorage<T, C>
Trait Implementations§
source§impl<T, Res, C> Ack<T, Res> for PostgresStorage<T, C>
impl<T, Res, C> Ack<T, Res> for PostgresStorage<T, C>
source§impl<T, C, Res> Backend<Request<T, SqlContext>, Res> for PostgresStorage<T, C>
impl<T, C, Res> Backend<Request<T, SqlContext>, Res> for PostgresStorage<T, C>
source§type Stream = BackendStream<Pin<Box<dyn Stream<Item = Result<Option<Request<T, SqlContext>>, Error>> + Send>>>
type Stream = BackendStream<Pin<Box<dyn Stream<Item = Result<Option<Request<T, SqlContext>>, Error>> + Send>>>
The stream to be produced by the backend
source§type Layer = AckLayer<PostgresStorage<T, C>, T, SqlContext, Res>
type Layer = AckLayer<PostgresStorage<T, C>, T, SqlContext, Res>
Returns the final decoration of layers
source§impl<T, C: Codec> Clone for PostgresStorage<T, C>
impl<T, C: Codec> Clone for PostgresStorage<T, C>
source§impl<T, C: Codec> Debug for PostgresStorage<T, C>
impl<T, C: Codec> Debug for PostgresStorage<T, C>
source§impl<Req, C> Storage for PostgresStorage<Req, C>
impl<Req, C> Storage for PostgresStorage<Req, C>
source§async fn push_request(
&mut self,
req: Request<Self::Job, SqlContext>,
) -> Result<Parts<SqlContext>, Error>
async fn push_request( &mut self, req: Request<Self::Job, SqlContext>, ) -> Result<Parts<SqlContext>, Error>
source§type Context = SqlContext
type Context = SqlContext
This is the type that storages store as the metadata related to a job
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<Req, SqlContext>,
wait: Duration,
) -> Result<(), Error>
async fn reschedule( &mut self, job: Request<Req, 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, Error>
async fn is_empty(&mut self) -> Result<bool, 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 PostgresStorage<T, C>
impl<T, C = JsonCodec<Value>> !RefUnwindSafe for PostgresStorage<T, C>
impl<T, C> Send for PostgresStorage<T, C>
impl<T, C> Sync for PostgresStorage<T, C>
impl<T, C> Unpin for PostgresStorage<T, C>
impl<T, C = JsonCodec<Value>> !UnwindSafe for PostgresStorage<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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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