pub trait Scanner:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn interval(&self) -> Duration;
fn scan_partition(
&self,
client: &Client,
partition: u16,
) -> impl Future<Output = ScanResult> + Send;
// Provided methods
fn filter(&self) -> &ScannerFilter { ... }
fn sample_backlog_depth(
&self,
_client: &Client,
_partition: u16,
) -> impl Future<Output = Option<u64>> + Send { ... }
}Expand description
Trait for background partition scanners.
Each implementation scans one aspect of execution state (lease expiry, delayed promotion, index consistency) across all partitions at a configured interval.
Required Methods§
Sourcefn scan_partition(
&self,
client: &Client,
partition: u16,
) -> impl Future<Output = ScanResult> + Send
fn scan_partition( &self, client: &Client, partition: u16, ) -> impl Future<Output = ScanResult> + Send
Scan a single partition. Called once per partition per cycle.
Provided Methods§
Sourcefn filter(&self) -> &ScannerFilter
fn filter(&self) -> &ScannerFilter
Per-consumer filter applied by execution-shaped scanners to restrict the set of candidates they act on (issue #122).
Default returns ScannerFilter::NOOP — pre-#122 behaviour.
Implementations override by storing a ScannerFilter on the
struct (constructed via Self::with_filter(..)) and
returning &self.filter.
Sourcefn sample_backlog_depth(
&self,
_client: &Client,
_partition: u16,
) -> impl Future<Output = Option<u64>> + Send
fn sample_backlog_depth( &self, _client: &Client, _partition: u16, ) -> impl Future<Output = Option<u64>> + Send
PR-94: per-cycle gauge sample. Returns Some(depth) summed
across all partitions by the scanner runner to produce a
single gauge value (today only cancel_reconciler exports
one, feeding ff_cancel_backlog_depth). Default: None so
scanners that don’t export a gauge compile unchanged.
Runs AFTER scan_partition for the same partition within
the same cycle, so implementations can reuse cached state.
The trivial default implementation returns None for every
partition and the runner writes nothing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.