pub struct CloudTaskQueue { /* private fields */ }Expand description
A priority-ordered queue of CloudTask items.
Tasks are stored in four internal lanes — one per QueuePriority — so
that higher-priority tasks are always served before lower-priority ones,
regardless of submission order.
Implementations§
Source§impl CloudTaskQueue
impl CloudTaskQueue
Sourcepub fn enqueue(
&mut self,
priority: QueuePriority,
payload: Vec<u8>,
) -> Result<u64, TaskQueueError>
pub fn enqueue( &mut self, priority: QueuePriority, payload: Vec<u8>, ) -> Result<u64, TaskQueueError>
Submit a task at the specified priority.
Expired tasks are purged from the queue before the capacity check so that the caller can always make room by waiting for TTLs to elapse.
Sourcepub fn enqueue_task(&mut self, task: CloudTask) -> Result<(), TaskQueueError>
pub fn enqueue_task(&mut self, task: CloudTask) -> Result<(), TaskQueueError>
Submit a pre-built CloudTask directly.
Sourcepub fn dequeue(&mut self) -> Result<CloudTask, TaskQueueError>
pub fn dequeue(&mut self) -> Result<CloudTask, TaskQueueError>
Dequeue the next highest-priority, non-expired task (Critical → Low).
Sourcepub fn dequeue_batch(
&mut self,
max_count: usize,
) -> Result<Vec<CloudTask>, TaskQueueError>
pub fn dequeue_batch( &mut self, max_count: usize, ) -> Result<Vec<CloudTask>, TaskQueueError>
Dequeue up to max_count tasks in priority order.
Returns an error if max_count is zero; returns a (possibly shorter)
Vec if fewer than max_count tasks are available.
Sourcepub fn lane_depth(&self, priority: QueuePriority) -> usize
pub fn lane_depth(&self, priority: QueuePriority) -> usize
Number of tasks waiting in the given priority lane.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CloudTaskQueue
impl RefUnwindSafe for CloudTaskQueue
impl Send for CloudTaskQueue
impl Sync for CloudTaskQueue
impl Unpin for CloudTaskQueue
impl UnsafeUnpin for CloudTaskQueue
impl UnwindSafe for CloudTaskQueue
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> 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 moreCreates a shared type from an unshared type.