pub struct JobQueue { /* private fields */ }Expand description
Job queue operations.
Implementations§
Source§impl JobQueue
impl JobQueue
Sourcepub async fn claim(
&self,
worker_id: Uuid,
capabilities: &[String],
limit: i32,
) -> Result<Vec<JobRecord>, Error>
pub async fn claim( &self, worker_id: Uuid, capabilities: &[String], limit: i32, ) -> Result<Vec<JobRecord>, Error>
Claim jobs using SKIP LOCKED pattern.
Sourcepub async fn complete(&self, job_id: Uuid, output: Value) -> Result<(), Error>
pub async fn complete(&self, job_id: Uuid, output: Value) -> Result<(), Error>
Mark job as completed.
Sourcepub async fn fail(
&self,
job_id: Uuid,
error: &str,
retry_delay: Option<Duration>,
) -> Result<(), Error>
pub async fn fail( &self, job_id: Uuid, error: &str, retry_delay: Option<Duration>, ) -> Result<(), Error>
Mark job as failed, schedule retry or move to dead letter.
Sourcepub async fn heartbeat(&self, job_id: Uuid) -> Result<(), Error>
pub async fn heartbeat(&self, job_id: Uuid) -> Result<(), Error>
Update heartbeat for a running job.
Sourcepub async fn update_progress(
&self,
job_id: Uuid,
percent: i32,
message: &str,
) -> Result<(), Error>
pub async fn update_progress( &self, job_id: Uuid, percent: i32, message: &str, ) -> Result<(), Error>
Update job progress.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JobQueue
impl !RefUnwindSafe for JobQueue
impl Send for JobQueue
impl Sync for JobQueue
impl Unpin for JobQueue
impl !UnwindSafe for JobQueue
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