Skip to main content

InterfaceAnnounceLimits

Struct InterfaceAnnounceLimits 

Source
pub struct InterfaceAnnounceLimits<C>{ /* private fields */ }

Implementations§

Source§

impl<C> InterfaceAnnounceLimits<C>

Source

pub fn record(&mut self, interface: InterfaceId, now: InstantMillis)

RNS 1.4.2 Interface.received_announce

Source

pub fn interface_attached(&mut self, interface: InterfaceId, now: InstantMillis)

Pins the interface’s age clock: RNS thresholds key on Interface.age(), time since the interface object’s creation, so hosts call this at attach. An interface never pinned starts its clock at the first recorded announce instead, and a returning interface keeps its original clock.

Source

pub fn should_limit( &mut self, interface: InterfaceId, now: InstantMillis, ) -> bool

RNS 1.4.2 Interface.should_ingress_limit: latch or clear the burst and report whether an unknown-destination announce arriving now should be held. Self::record runs before this for every announce, known or unknown destination, so the announce being judged already counts toward its own reading; only unknown destinations consult this judgment, so known-destination floods raise the rate without touching the latch. Both behaviors mirror the reference’s call order.

Source

pub fn should_limit_with_policy( &mut self, interface: InterfaceId, now: InstantMillis, policy: IngressControlPolicy, ) -> bool

Source

pub fn next_held_release_at( &self, interface: InterfaceId, ) -> Option<InstantMillis>

RNS Interface.ic_held_release: the next instant a held announce may drip out, stamped now + IC_BURST_PENALTY when the burst latches.

Source

pub fn schedule_next_held_release( &mut self, interface: InterfaceId, now: InstantMillis, )

RNS Interface.process_held_announces advances ic_held_release by IC_HELD_RELEASE_INTERVAL on each release.

Source

pub fn schedule_next_held_release_with_policy( &mut self, interface: InterfaceId, now: InstantMillis, policy: IngressControlPolicy, )

Source

pub fn rate_is_under_limit( &self, interface: InterfaceId, now: InstantMillis, ) -> bool

The gate RNS Interface.process_held_announces puts on each release: ia_freq < freq_threshold, strictly. An interface with no samples reads under.

Source

pub fn rate_is_under_limit_with_policy( &self, interface: InterfaceId, now: InstantMillis, policy: IngressControlPolicy, ) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl<C> Debug for InterfaceAnnounceLimits<C>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<C> Default for InterfaceAnnounceLimits<C>

Source§

fn default() -> InterfaceAnnounceLimits<C>

Returns the “default value” for a type. 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, 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> Same for T

Source§

type Output = T

Should always be Self
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.