Skip to main content

EdgePolicy

Struct EdgePolicy 

Source
#[non_exhaustive]
pub struct EdgePolicy { pub caps: QueueCaps, pub admission: AdmissionPolicy, pub over_budget: OverBudgetAction, }
Expand description

Per-edge policy bundle.

caps → soft/hard watermarks; admission → behavior between soft/hard; over_budget → action when capacity/budget constraints are breached.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§caps: QueueCaps

Capacity and watermarks.

§admission: AdmissionPolicy

Admission behavior between soft and hard thresholds.

§over_budget: OverBudgetAction

Action to take on over-budget scenarios at this edge.

Implementations§

Source§

impl EdgePolicy

Source

pub const fn new( caps: QueueCaps, admission: AdmissionPolicy, over_budget: OverBudgetAction, ) -> Self

Construct a new EdgePolicy.

Source

pub const fn caps(&self) -> &QueueCaps

Borrow caps.

Source

pub const fn admission(&self) -> &AdmissionPolicy

Borrow admission policy.

Source

pub const fn over_budget(&self) -> &OverBudgetAction

Borrow over-budget action.

Source

pub fn watermark(&self, items: usize, bytes: usize) -> WatermarkState

Compute a watermark state from occupancy stats.

Source

pub fn decide( &self, items: usize, bytes: usize, item_bytes: usize, _deadline: Option<DeadlineNs>, _qos: QoSClass, ) -> AdmissionDecision

Apply admission logic based on header hints (deadline/qos) and occupancy.

§Behaviour
  • BelowSoft => Admit.
  • BetweenSoftAndHard:
    • DeadlineAndQoSAware => consult deadline/qos to decide (TODO: full impl).
    • DropNewest => DropNewest.
    • DropOldest => Evict(1).
    • Block => Block.
  • AtOrAboveHard:
    • If the single incoming item cannot fit under the hard cap (even when the queue is empty), the item is Rejected immediately.
    • Otherwise:
      • DropNewest => DropNewest.
      • DropOldest => EvictUntilBelowHard.
      • DeadlineAndQoSAware => conservative default Reject (or consult deadline/qos if implemented).
      • Block => Block.
§Warning

QoS-aware behaviour is not yet implemented. The DeadlineAndQoSAware branch currently uses conservative defaults:

  • between soft/hard it defaults to Admit, and
  • at-or-above-hard it defaults to Reject.

Implementors should update this method to use deadline and QoS hints when the scheduler rules are available.

Trait Implementations§

Source§

impl Clone for EdgePolicy

Source§

fn clone(&self) -> EdgePolicy

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EdgePolicy

Source§

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

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

impl PartialEq for EdgePolicy

Source§

fn eq(&self, other: &EdgePolicy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for EdgePolicy

Source§

impl Eq for EdgePolicy

Source§

impl StructuralPartialEq for EdgePolicy

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.