pub struct InMemoryTaskQueue { /* private fields */ }Expand description
Thread-safe in-memory task queue.
Implementations§
Trait Implementations§
Source§impl Default for InMemoryTaskQueue
impl Default for InMemoryTaskQueue
Source§impl TaskQueue for InMemoryTaskQueue
impl TaskQueue for InMemoryTaskQueue
Source§fn enqueue(
&self,
task_id: TaskId,
run_id: RunId,
priority: u32,
command_class: CommandClass,
available_at: Option<DateTime<Utc>>,
) -> Result<Uuid, QueueError>
fn enqueue( &self, task_id: TaskId, run_id: RunId, priority: u32, command_class: CommandClass, available_at: Option<DateTime<Utc>>, ) -> Result<Uuid, QueueError>
Enqueue a task for scheduling. Read more
Source§fn claim(
&self,
request: &ClaimRequest,
config: &ConcurrencyConfig,
) -> Result<Vec<QueueEntry>, QueueError>
fn claim( &self, request: &ClaimRequest, config: &ConcurrencyConfig, ) -> Result<Vec<QueueEntry>, QueueError>
Claim up to
limit pending tasks, ordered by priority DESC (with aging). Read moreSource§fn heartbeat(
&self,
queue_id: Uuid,
worker_id: &str,
lease_ttl: Duration,
) -> Result<(), QueueError>
fn heartbeat( &self, queue_id: Uuid, worker_id: &str, lease_ttl: Duration, ) -> Result<(), QueueError>
Extend the lease for an active entry (heartbeat). Read more
Source§fn complete(&self, queue_id: Uuid, worker_id: &str) -> Result<(), QueueError>
fn complete(&self, queue_id: Uuid, worker_id: &str) -> Result<(), QueueError>
Mark a leased entry as completed. Only the lease owner can complete.
Source§fn fail(&self, queue_id: Uuid, worker_id: &str) -> Result<(), QueueError>
fn fail(&self, queue_id: Uuid, worker_id: &str) -> Result<(), QueueError>
Mark a leased entry as failed. Only the lease owner can fail.
Source§fn override_priority(
&self,
task_id: TaskId,
priority: u32,
) -> Result<(), QueueError>
fn override_priority( &self, task_id: TaskId, priority: u32, ) -> Result<(), QueueError>
Update priority for all entries for a task. Read more
Source§fn cancel(&self, queue_id: Uuid) -> Result<(), QueueError>
fn cancel(&self, queue_id: Uuid) -> Result<(), QueueError>
Override priority for all known entries belonging to a task. Read more
Source§fn reclaim_stale(&self, grace_period: Duration) -> Result<usize, QueueError>
fn reclaim_stale(&self, grace_period: Duration) -> Result<usize, QueueError>
Reclaim stale leases: entries where
lease_expires_at + grace < now. Read moreSource§fn stats(&self) -> QueueStats
fn stats(&self) -> QueueStats
Return the number of entries in each status.
Source§fn leased_count_for_run(&self, run_id: RunId) -> usize
fn leased_count_for_run(&self, run_id: RunId) -> usize
Return the number of currently leased entries for a given run.
Source§fn leased_count_for_class(&self, class: CommandClass) -> usize
fn leased_count_for_class(&self, class: CommandClass) -> usize
Return the number of currently leased entries for a given command class.
Source§fn pending_count(&self) -> usize
fn pending_count(&self) -> usize
Return total pending entries.
Source§fn cancel_for_run(&self, run_id: RunId) -> Result<usize, QueueError>
fn cancel_for_run(&self, run_id: RunId) -> Result<usize, QueueError>
Cancel all pending and leased entries for a given run. Read more
Source§fn cancel_stale_runs(
&self,
active_run_ids: &[RunId],
) -> Result<usize, QueueError>
fn cancel_stale_runs( &self, active_run_ids: &[RunId], ) -> Result<usize, QueueError>
Cancel all pending and leased entries NOT belonging to the given set of run IDs. Read more
Auto Trait Implementations§
impl !Freeze for InMemoryTaskQueue
impl RefUnwindSafe for InMemoryTaskQueue
impl Send for InMemoryTaskQueue
impl Sync for InMemoryTaskQueue
impl Unpin for InMemoryTaskQueue
impl UnsafeUnpin for InMemoryTaskQueue
impl UnwindSafe for InMemoryTaskQueue
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> 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