pub struct JobQueue { /* private fields */ }Expand description
Redis-backed job queue.
Enqueues jobs into priority-separated Redis lists. Job metadata is stored in Redis hashes for status queries.
Implementations§
Source§impl JobQueue
impl JobQueue
Sourcepub async fn enqueue(
&self,
name: &str,
payload: Value,
priority: JobPriority,
) -> Result<String, ShaperailError>
pub async fn enqueue( &self, name: &str, payload: Value, priority: JobPriority, ) -> Result<String, ShaperailError>
Enqueues a job with the given name, payload, and priority.
Returns the generated job ID.
Sourcepub async fn enqueue_with_options(
&self,
name: &str,
payload: Value,
priority: JobPriority,
max_retries: u32,
timeout_secs: u64,
) -> Result<String, ShaperailError>
pub async fn enqueue_with_options( &self, name: &str, payload: Value, priority: JobPriority, max_retries: u32, timeout_secs: u64, ) -> Result<String, ShaperailError>
Enqueues a job with full configuration.
max_retries — how many times to retry on failure (default 3).
timeout_secs — auto-fail after this duration (default 300s).
Sourcepub async fn get_status(&self, job_id: &str) -> Result<JobInfo, ShaperailError>
pub async fn get_status(&self, job_id: &str) -> Result<JobInfo, ShaperailError>
Retrieves the status/info of a job by ID.
Sourcepub async fn total_depth(&self) -> Result<i64, ShaperailError>
pub async fn total_depth(&self) -> Result<i64, ShaperailError>
Returns the total number of queued jobs across all priority levels.
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 UnsafeUnpin 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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request