pub struct DebouncedCheckpointStore { /* private fields */ }Expand description
Debouncing decorator over a KeyedCheckpointStore (#784, keyed in #1092).
Buffers record_checkpoint in memory per CheckpointKey and forwards a
durable write for a key only when its buffered block is at least flush_blocks
ahead of that key’s last persisted value or at least flush_interval has
elapsed since that key’s last durable write — cutting the per-block fsync
amplification a watcher’s live tail would otherwise pay on a backlog drain.
Durability contract preserved (per key). The persisted value is only ever
a floor for the resume backfill (the resumable watcher rewinds it by
REORG_MARGIN_BLOCKS and every sink is idempotent), so a
buffered-but-not-yet-fsynced advance that a crash loses merely widens the next
rescan — never narrows it. record_checkpoint only raises a key’s pending,
so the forwarded value stays monotonic. Self::flush_checkpoint forces the
buffered value out and is wired into graceful shutdown.
Implementations§
Source§impl DebouncedCheckpointStore
impl DebouncedCheckpointStore
Sourcepub fn new(inner: Arc<dyn KeyedCheckpointStore>) -> Self
pub fn new(inner: Arc<dyn KeyedCheckpointStore>) -> Self
Wrap inner with the production debounce thresholds
(CHECKPOINT_FLUSH_BLOCKS / CHECKPOINT_FLUSH_INTERVAL) and the real wall
clock.
Trait Implementations§
Source§impl Debug for DebouncedCheckpointStore
impl Debug for DebouncedCheckpointStore
Source§impl KeyedCheckpointStore for DebouncedCheckpointStore
impl KeyedCheckpointStore for DebouncedCheckpointStore
Source§fn load_checkpoint(&self, key: CheckpointKey) -> Result<Option<u64>, StoreError>
fn load_checkpoint(&self, key: CheckpointKey) -> Result<Option<u64>, StoreError>
key, or None on a never-written key
(first-ever boot for that watcher — the caller applies its configured
none-fallback floor). Read moreSource§fn record_checkpoint(
&self,
key: CheckpointKey,
block: u64,
) -> Result<(), StoreError>
fn record_checkpoint( &self, key: CheckpointKey, block: u64, ) -> Result<(), StoreError>
key. Overwrites the prior value.
Called as each backfill window and live tick advances, so the next boot
resumes from here. Read moreSource§fn flush_checkpoint(&self, key: CheckpointKey) -> Result<(), StoreError>
fn flush_checkpoint(&self, key: CheckpointKey) -> Result<(), StoreError>
key to durable storage. The default
is a no-op: implementations that already commit durably inside
record_checkpoint have nothing buffered. A
debouncing decorator overrides this to fsync the latest deferred block,
and the runtime calls it on graceful shutdown so the most recent scan
progress is not lost to the next boot’s rescan. Read moreAuto Trait Implementations§
impl !Freeze for DebouncedCheckpointStore
impl !RefUnwindSafe for DebouncedCheckpointStore
impl !UnwindSafe for DebouncedCheckpointStore
impl Send for DebouncedCheckpointStore
impl Sync for DebouncedCheckpointStore
impl Unpin for DebouncedCheckpointStore
impl UnsafeUnpin for DebouncedCheckpointStore
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> 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