pub struct Batch { /* private fields */ }Expand description
A snapshot of a batch at the time it was read, with its job counts and the times it was created, cancelled, and finished.
Batch serializes to JSON, so a route can return it to show a batch’s progress.
Implementations§
Source§impl Batch
impl Batch
Sourcepub const fn total_jobs(&self) -> u64
pub const fn total_jobs(&self) -> u64
The number of jobs in the batch, including the later jobs of its chains and the jobs added to it.
Sourcepub const fn pending_jobs(&self) -> u64
pub const fn pending_jobs(&self) -> u64
The number of the batch’s jobs that haven’t succeeded or been skipped.
A failed job counts as pending until a retry of it succeeds.
Sourcepub const fn failed_jobs(&self) -> u64
pub const fn failed_jobs(&self) -> u64
The number of the batch’s jobs that have failed for good and haven’t succeeded on a retry since.
Sourcepub const fn processed_jobs(&self) -> u64
pub const fn processed_jobs(&self) -> u64
The number of the batch’s jobs that have succeeded or been skipped.
Sourcepub const fn progress(&self) -> u8
pub const fn progress(&self) -> u8
The percentage of the batch’s jobs that have been processed, from 0 to 100.
Sourcepub const fn created_at(&self) -> Timestamp
pub const fn created_at(&self) -> Timestamp
When the batch was dispatched.
Sourcepub const fn cancelled_at(&self) -> Option<Timestamp>
pub const fn cancelled_at(&self) -> Option<Timestamp>
When the batch was cancelled, if it was.
Sourcepub const fn finished_at(&self) -> Option<Timestamp>
pub const fn finished_at(&self) -> Option<Timestamp>
When every job of the batch had run, or None if some jobs haven’t run yet.
Sourcepub const fn is_finished(&self) -> bool
pub const fn is_finished(&self) -> bool
Whether every job of the batch has run, meaning each job has succeeded, failed, or been skipped.
Sourcepub const fn is_cancelled(&self) -> bool
pub const fn is_cancelled(&self) -> bool
Whether the batch has been cancelled.
Sourcepub const fn has_failures(&self) -> bool
pub const fn has_failures(&self) -> bool
Whether any of the batch’s jobs has failed for good.
Trait Implementations§
impl Eq for Batch
Source§impl Serialize for Batch
impl Serialize for Batch
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Batch
Auto Trait Implementations§
impl Forget for Batch
impl Freeze for Batch
impl Move for Batch
impl RefUnwindSafe for Batch
impl Send for Batchwhere
RawVecInner: Send,
impl Sync for Batchwhere
RawVecInner: Sync,
impl Unpin for Batch
impl UnsafeUnpin for Batch
impl UnwindSafe for Batchwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
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> ⓘ
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> ⓘ
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