#[non_exhaustive]pub struct PurgeReport {
pub tasks_deleted: u64,
pub orphan_rows_deleted: u64,
pub idempotency_keys_deleted: u64,
pub batches: u32,
pub complete: bool,
}Expand description
What one call to purge_expired did.
#[non_exhaustive]: read its fields, do not construct or exhaustively
destructure it. A sweep that learns to count something new should not be a
breaking change — 0.13.0’s breaking list already carries one renamed field
of this struct.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tasks_deleted: u64Task rows deleted.
orphan_rows_deleted: u64Side-table rows this sweep had to reclaim itself: artifact-journal rows and event-log rows whose task was deleted.
Normally zero, and that is the healthy reading: both tables have
an ON DELETE CASCADE, so on a pool with foreign_keys=ON — which
SqliteTaskStore::new sets — the rows go with the task and the sweep
finds nothing left to do. A non-zero count means rows had outlived
their task, which happens when from_pool was handed a pool without
the pragma.
§It is zero on PostgreSQL because nothing counts there
Only the SQLite sweep runs anti-join deletes; the PostgreSQL one
has no orphan statement at all, so this field is structurally zero on
both Postgres stores rather than observed to be. That is a deliberate
omission and not an oversight: PostgreSQL has no per-session
equivalent of foreign_keys=OFF, so a declared ON DELETE CASCADE
always fires and there is nothing for a sweep to find.
The residual case it does not cover is a caller who handed
from_pool a database in which task_events or tenant_task_events
already existed without the foreign key — CREATE TABLE IF NOT EXISTS
leaves such a table alone. Rows can then be stranded there and no
Postgres sweep will reclaim them. Declare the tables from this crate’s
own DDL, or from its migration runner, and the case does not arise.
Since 0.13 the SQLite sweep runs on every purge rather than only on
one that deleted a task: a purge that fails part way strands rows that
outlive it, and the sweep is what reclaims them.
idempotency_keys_deleted: u64Idempotency keys deleted for being older than
RetentionPolicy::idempotency_key_max_age.
Zero when that is None, and zero on a sweep that finds none expired.
Unlike orphan_rows_deleted a non-zero
count here is the healthy reading, not a warning: it is the sweep doing
the job it was given.
batches: u32Batches executed.
complete: boolfalse when RetentionPolicy::max_batches stopped the sweep with
work still to do, so a caller can tell “nothing left” from “ran out of
budget” instead of inferring it from a count.
Trait Implementations§
Source§impl Clone for PurgeReport
impl Clone for PurgeReport
Source§fn clone(&self) -> PurgeReport
fn clone(&self) -> PurgeReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PurgeReport
Source§impl Debug for PurgeReport
impl Debug for PurgeReport
Source§impl Default for PurgeReport
impl Default for PurgeReport
Source§fn default() -> PurgeReport
fn default() -> PurgeReport
impl Eq for PurgeReport
Source§impl PartialEq for PurgeReport
impl PartialEq for PurgeReport
impl StructuralPartialEq for PurgeReport
Auto Trait Implementations§
impl Freeze for PurgeReport
impl RefUnwindSafe for PurgeReport
impl Send for PurgeReport
impl Sync for PurgeReport
impl Unpin for PurgeReport
impl UnsafeUnpin for PurgeReport
impl UnwindSafe for PurgeReport
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.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 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>
T in a tonic::Request