pub struct TxAgeSweepState { /* private fields */ }Expand description
ADR-091 Plank 1 background-sweep state, carried across ticks by the
caller alongside CheckpointSeverityState and TruncateState. Pure
state machine: no I/O, no logging — callers turn the returned emissions
into tracing calls, mirroring CheckpointSeverityState’s shape.
Keyed off khive_storage::tx_registry::oldest() — the single oldest
entry across every registered span, regardless of which call site created
it. Deliberately a different signal from the WAL-pressure ladder: a span
can go stale under low WAL pressure, or vice versa. See
crates/khive-db/docs/api/checkpoint.md for the full rationale.
Implementations§
Source§impl TxAgeSweepState
impl TxAgeSweepState
Sourcepub fn observe(
&mut self,
oldest: Option<(TxId, Duration, Option<String>)>,
config: &CheckpointConfig,
) -> Vec<TxAgeEmission>
pub fn observe( &mut self, oldest: Option<(TxId, Duration, Option<String>)>, config: &CheckpointConfig, ) -> Vec<TxAgeEmission>
Advance by one observed tick given the registry’s current oldest
entry (identity, age, label), or None if empty. Returns zero, one,
or two emissions — an entry already stale the first time it’s seen
under a given identity crosses both rungs on the same tick.
A below-threshold (or absent) oldest entry resets both latches. A
change in the oldest entry’s TxId
also force-resets both latches before re-evaluating age, so a
departed span’s latched state cannot suppress the crossing for an
already-stale successor. See crates/khive-db/docs/api/checkpoint.md
for why identity tracking is required here, not just the age check.
Trait Implementations§
Source§impl Clone for TxAgeSweepState
impl Clone for TxAgeSweepState
Source§fn clone(&self) -> TxAgeSweepState
fn clone(&self) -> TxAgeSweepState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TxAgeSweepState
impl Debug for TxAgeSweepState
Source§impl Default for TxAgeSweepState
impl Default for TxAgeSweepState
Source§fn default() -> TxAgeSweepState
fn default() -> TxAgeSweepState
Auto Trait Implementations§
impl Freeze for TxAgeSweepState
impl RefUnwindSafe for TxAgeSweepState
impl Send for TxAgeSweepState
impl Sync for TxAgeSweepState
impl Unpin for TxAgeSweepState
impl UnsafeUnpin for TxAgeSweepState
impl UnwindSafe for TxAgeSweepState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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