Skip to main content

ResizeCoalescer

Struct ResizeCoalescer 

Source
pub struct ResizeCoalescer { /* private fields */ }
Expand description

Adaptive resize stream coalescer.

Implements latest-wins coalescing with regime-aware behavior.

Implementations§

Source§

impl ResizeCoalescer

Source

pub fn new(config: CoalescerConfig, initial_size: (u16, u16)) -> Self

Create a new coalescer with the given configuration and initial size.

Source

pub fn with_telemetry_hooks(self, hooks: TelemetryHooks) -> Self

Attach telemetry hooks for external observability.

Source

pub fn with_evidence_sink(self, sink: EvidenceSink) -> Self

Attach an evidence sink for JSONL decision logs.

Source

pub fn with_evidence_run_id(self, run_id: impl Into<String>) -> Self

Set the run identifier used in evidence logs.

Source

pub fn with_screen_mode(self, screen_mode: ScreenMode) -> Self

Set the screen mode label used in evidence logs.

Source

pub fn set_evidence_sink(&mut self, sink: Option<EvidenceSink>)

Set or clear the evidence sink.

Source

pub fn with_last_render(self, time: Instant) -> Self

Set the last render time (for deterministic testing).

Source

pub fn record_external_apply(&mut self, width: u16, height: u16, now: Instant)

Record an externally-applied resize (immediate path).

Source

pub fn regime_transition_count(&self) -> u64

Get current regime transition count.

Source

pub fn cycle_time_percentiles(&self) -> Option<CycleTimePercentiles>

Get cycle time percentiles (p50, p95, p99) in milliseconds. Returns None if no cycle times recorded.

Source

pub fn handle_resize(&mut self, width: u16, height: u16) -> CoalesceAction

Handle a resize event.

Returns the action to take immediately.

Source

pub fn handle_resize_at( &mut self, width: u16, height: u16, now: Instant, ) -> CoalesceAction

Handle a resize event at a specific time (for testing).

Source

pub fn tick(&mut self) -> CoalesceAction

Tick the coalescer (call each frame).

Returns the action to take.

Source

pub fn tick_at(&mut self, now: Instant) -> CoalesceAction

Tick at a specific time (for testing).

Source

pub fn time_until_apply(&self, now: Instant) -> Option<Duration>

Time until the pending resize should be applied.

Source

pub fn has_pending(&self) -> bool

Check if there’s a pending resize.

Source

pub fn regime(&self) -> Regime

Get the current regime.

Source

pub fn bocpd_enabled(&self) -> bool

Check if BOCPD-based regime detection is enabled.

Source

pub fn bocpd(&self) -> Option<&BocpdDetector>

Get the BOCPD detector for inspection (if enabled).

Returns None if BOCPD is not enabled.

Source

pub fn bocpd_p_burst(&self) -> Option<f64>

Get the current P(burst) from BOCPD (if enabled).

Returns the posterior probability that the system is in burst regime. Returns None if BOCPD is not enabled.

Get the recommended delay from BOCPD (if enabled).

Returns the recommended coalesce delay in milliseconds based on the current posterior distribution. Returns None if BOCPD is not enabled.

Source

pub fn event_rate(&self) -> f64

Get the current event rate (events/second).

Source

pub fn last_applied(&self) -> (u16, u16)

Get the last applied size.

Source

pub fn logs(&self) -> &[DecisionLog]

Get decision logs (if logging enabled).

Source

pub fn clear_logs(&mut self)

Clear decision logs.

Source

pub fn stats(&self) -> CoalescerStats

Get statistics about the coalescer.

Source

pub fn decision_logs_jsonl(&self) -> String

Export decision logs as JSONL (one entry per line).

Source

pub fn decision_checksum(&self) -> u64

Compute a deterministic checksum of decision logs.

Source

pub fn decision_checksum_hex(&self) -> String

Compute checksum as hex string.

Source

pub fn decision_summary(&self) -> DecisionSummary

Compute a summary of the decision log.

Source

pub fn evidence_to_jsonl(&self) -> String

Export config + decision logs + summary as JSONL.

Trait Implementations§

Source§

impl Debug for ResizeCoalescer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more