pub struct FakeQueue { /* private fields */ }Expand description
A queue that records dispatches and runs nothing.
Implementations§
Source§impl FakeQueue
impl FakeQueue
pub fn new() -> Self
Sourcepub fn pushed(&self, name: &str) -> Vec<QueuedJob>
pub fn pushed(&self, name: &str) -> Vec<QueuedJob>
The jobs pushed under one name — for asserting on a payload.
Sourcepub fn assert_pushed(&self, name: &str) -> &Self
pub fn assert_pushed(&self, name: &str) -> &Self
Assert a job with this name was dispatched at least once.
Sourcepub fn assert_pushed_times(&self, name: &str, times: usize) -> &Self
pub fn assert_pushed_times(&self, name: &str, times: usize) -> &Self
Assert a job with this name was dispatched exactly times times.
Sourcepub fn assert_not_pushed(&self, name: &str) -> &Self
pub fn assert_not_pushed(&self, name: &str) -> &Self
Assert a job with this name was never dispatched.
Sourcepub fn assert_nothing_pushed(&self) -> &Self
pub fn assert_nothing_pushed(&self) -> &Self
Assert nothing at all was dispatched.
Sourcepub fn assert_pushed_on(&self, queue: &str, name: &str) -> &Self
pub fn assert_pushed_on(&self, queue: &str, name: &str) -> &Self
Assert a job was dispatched onto a particular queue.
Sourcepub fn assert_pushed_later(&self, name: &str, delay: Duration) -> &Self
pub fn assert_pushed_later(&self, name: &str, delay: Duration) -> &Self
Assert a job was dispatched with a delay of at least delay.
Trait Implementations§
Source§impl Queue for FakeQueue
impl Queue for FakeQueue
Source§fn pop<'a>(
&'a self,
_queue: &'a str,
) -> BoxFuture<'a, Result<Option<ReservedJob>>>
fn pop<'a>( &'a self, _queue: &'a str, ) -> BoxFuture<'a, Result<Option<ReservedJob>>>
Always empty. A fake that handed jobs back would run them, which is the one thing it exists not to do.
Source§fn driver(&self) -> &'static str
fn driver(&self) -> &'static str
The driver’s name. It appears in
queue.* events and error messages,
which is how Telescope shows which backend handled a job.Source§fn push(&self, job: QueuedJob) -> BoxFuture<'_, Result<String>>
fn push(&self, job: QueuedJob) -> BoxFuture<'_, Result<String>>
Store a job. Returns the driver’s identifier for it. Read more
Source§fn size<'a>(&'a self, queue: &'a str) -> BoxFuture<'a, Result<u64>>
fn size<'a>(&'a self, queue: &'a str) -> BoxFuture<'a, Result<u64>>
How many jobs are waiting on a queue, including delayed ones.
Source§fn delete<'a>(&'a self, _job: &'a ReservedJob) -> BoxFuture<'a, Result<()>>
fn delete<'a>(&'a self, _job: &'a ReservedJob) -> BoxFuture<'a, Result<()>>
Finish with a reserved job: it succeeded and is gone.
Source§fn release<'a>(
&'a self,
_job: &'a ReservedJob,
_delay: Duration,
) -> BoxFuture<'a, Result<()>>
fn release<'a>( &'a self, _job: &'a ReservedJob, _delay: Duration, ) -> BoxFuture<'a, Result<()>>
Put a reserved job back, available again after
delay. Read moreSource§fn fail<'a>(
&'a self,
_job: &'a ReservedJob,
_error: &'a str,
) -> BoxFuture<'a, Result<()>>
fn fail<'a>( &'a self, _job: &'a ReservedJob, _error: &'a str, ) -> BoxFuture<'a, Result<()>>
Move a reserved job to the dead-letter store with the error that killed
it. It must no longer be on the queue afterwards.
Source§fn failed_jobs(&self) -> BoxFuture<'_, Result<Vec<FailedJob>>>
fn failed_jobs(&self) -> BoxFuture<'_, Result<Vec<FailedJob>>>
Everything in the dead-letter store, oldest first.
Source§fn clear<'a>(&'a self, queue: &'a str) -> BoxFuture<'a, Result<u64>>
fn clear<'a>(&'a self, queue: &'a str) -> BoxFuture<'a, Result<u64>>
Throw away every job waiting on a queue. Returns how many went.
Auto Trait Implementations§
impl !Freeze for FakeQueue
impl RefUnwindSafe for FakeQueue
impl Send for FakeQueue
impl Sync for FakeQueue
impl Unpin for FakeQueue
impl UnsafeUnpin for FakeQueue
impl UnwindSafe for FakeQueue
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> QueueExt for T
impl<T> QueueExt for T
Source§fn dispatch_chain<'a>(&'a self, chain: Chain) -> BoxFuture<'a, Result<String>>
fn dispatch_chain<'a>(&'a self, chain: Chain) -> BoxFuture<'a, Result<String>>
dispatch(SendWelcomeEmail { user_id }) — the everyday call.
Push the first step of a chain; the worker pushes each next step as
the one before it succeeds. Returns the first step’s id.