pub struct QueueRepository { /* private fields */ }Expand description
Queue repository for push/pop operations using SKIP LOCKED
Implementations§
Source§impl QueueRepository
impl QueueRepository
pub fn new(pool: PgPool) -> Self
Sourcepub async fn push<T: Serialize>(
&self,
queue: &QueueName,
payload: &T,
) -> Result<i64>
pub async fn push<T: Serialize>( &self, queue: &QueueName, payload: &T, ) -> Result<i64>
Push a job to the queue
Sourcepub async fn pop<T: DeserializeOwned>(
&self,
queue: &QueueName,
) -> Result<Option<Job<T>>>
pub async fn pop<T: DeserializeOwned>( &self, queue: &QueueName, ) -> Result<Option<Job<T>>>
Pop a job from the queue using SKIP LOCKED for concurrent safety. Returns None if no pending jobs are available.
Sourcepub async fn complete(&self, queue: &QueueName, job_id: i64) -> Result<()>
pub async fn complete(&self, queue: &QueueName, job_id: i64) -> Result<()>
Mark a job as completed
Sourcepub async fn fail(&self, queue: &QueueName, job_id: i64) -> Result<()>
pub async fn fail(&self, queue: &QueueName, job_id: i64) -> Result<()>
Mark a job as failed, resetting it to pending for retry
Sourcepub async fn pending_count(&self, queue: &QueueName) -> Result<i64>
pub async fn pending_count(&self, queue: &QueueName) -> Result<i64>
Get the count of pending jobs in a queue
Trait Implementations§
Source§impl Clone for QueueRepository
impl Clone for QueueRepository
Source§fn clone(&self) -> QueueRepository
fn clone(&self) -> QueueRepository
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for QueueRepository
impl !RefUnwindSafe for QueueRepository
impl Send for QueueRepository
impl Sync for QueueRepository
impl Unpin for QueueRepository
impl UnsafeUnpin for QueueRepository
impl !UnwindSafe for QueueRepository
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