Skip to main content

PaddingBackend

Trait PaddingBackend 

Source
pub(super) trait PaddingBackend: Send + Sync {
    // Required methods
    fn report_events_at(
        &mut self,
        events: &[TriggerEvent],
        now: Instant,
        next_scheduled_wakeup: Option<Instant>,
    );
    fn take_padding_events_at(
        &mut self,
        now: Instant,
        next_scheduled_wakeup: Option<Instant>,
    ) -> Vec<PerHopPaddingEvent>;
    fn next_wakeup(&mut self, waker: &Waker) -> Option<Instant>;
}
Expand description

Helper trait: Used to wrap a single MaybenotPadder.

(We don’t use MaybenotPadder directly because we want to keep the freedom to parameterize it differently, or maybe even to replace it with something else.)

Required Methods§

Source

fn report_events_at( &mut self, events: &[TriggerEvent], now: Instant, next_scheduled_wakeup: Option<Instant>, )

Report one or more TriggerEvents to the padder.

Alert any registered Waker if these events cause us to need to take action earlier than next_scheduled_wakeup.

Source

fn take_padding_events_at( &mut self, now: Instant, next_scheduled_wakeup: Option<Instant>, ) -> Vec<PerHopPaddingEvent>

Trigger any padding actions that should be taken now.

If we should perform any actions (blocking, unblocking, or sending padding), return them in a PerHopPaddingEventVec.

Alert any registered Waker if these events cause us to need to take action earlier than next_scheduled_wakeup.

Source

fn next_wakeup(&mut self, waker: &Waker) -> Option<Instant>

This method should be called when we have no actions to perform, with a Waker that will activate the corresponding PaddingEventStream.

It will return a time at which pending_events_at() should next be called, and will wake up the Waker if it turns out that we need to call pending_events_at() any earlier than that.

Implementors§