Skip to main content

DatabaseQueue

Struct DatabaseQueue 

Source
pub struct DatabaseQueue { /* private fields */ }
Expand description

Jobs in the application’s database.

Implementations§

Source§

impl DatabaseQueue

Source

pub fn new(db: Db) -> Self

Trait Implementations§

Source§

impl Clone for DatabaseQueue

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl QueueDriver for DatabaseQueue

Source§

fn name(&self) -> &'static str

Source§

fn push<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, queue: &'life1 str, name: &'life2 str, payload: &'life3 Value, available_at: DateTime<Utc>, unique_key: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = CoreResult<Option<i64>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Stores a job; None when unique_key names one already waiting.
Source§

fn claim<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, queues: &'life1 [String], retry_after: Duration, worker: &'life2 str, ) -> Pin<Box<dyn Future<Output = CoreResult<Option<Queued>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Claims the oldest job due on one of queues, or one whose claim is older than retry_after, for worker. Its attempts count this claim.
Source§

fn release<'life0, 'async_trait>( &'life0 self, id: i64, available_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Puts a claimed job back, due at available_at.
Source§

fn delete<'life0, 'async_trait>( &'life0 self, id: i64, ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Removes a finished job.
Source§

fn fail<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, job: &'life1 Queued, error: &'life2 str, ) -> Pin<Box<dyn Future<Output = CoreResult<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Moves a job to the failed list; returns the failed row’s id.
Source§

fn counts<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = CoreResult<Vec<QueueCount>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn failed<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = CoreResult<Vec<FailedJob>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn retry<'life0, 'async_trait>( &'life0 self, id: Option<i64>, ) -> Pin<Box<dyn Future<Output = CoreResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Puts a failed job (or every one, with None) back on its queue; returns how many moved.
Source§

fn forget<'life0, 'async_trait>( &'life0 self, id: Option<i64>, ) -> Pin<Box<dyn Future<Output = CoreResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Drops a failed job (or every one, with None); returns how many went.
Source§

fn clear<'life0, 'life1, 'async_trait>( &'life0 self, queue: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = CoreResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Drops every waiting job on queue, or on every queue with None.
Source§

fn ping<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Checks the store answers; a driver with nothing to check says yes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more