#[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: QueueCapsCapacity and watermarks.
admission: AdmissionPolicyAdmission behavior between soft and hard thresholds.
over_budget: OverBudgetActionAction to take on over-budget scenarios at this edge.
Implementations§
Source§impl EdgePolicy
impl EdgePolicy
Sourcepub const fn new(
caps: QueueCaps,
admission: AdmissionPolicy,
over_budget: OverBudgetAction,
) -> Self
pub const fn new( caps: QueueCaps, admission: AdmissionPolicy, over_budget: OverBudgetAction, ) -> Self
Construct a new EdgePolicy.
Sourcepub const fn admission(&self) -> &AdmissionPolicy
pub const fn admission(&self) -> &AdmissionPolicy
Borrow admission policy.
Sourcepub const fn over_budget(&self) -> &OverBudgetAction
pub const fn over_budget(&self) -> &OverBudgetAction
Borrow over-budget action.
Sourcepub fn watermark(&self, items: usize, bytes: usize) -> WatermarkState
pub fn watermark(&self, items: usize, bytes: usize) -> WatermarkState
Compute a watermark state from occupancy stats.
Sourcepub fn decide(
&self,
items: usize,
bytes: usize,
item_bytes: usize,
_deadline: Option<DeadlineNs>,
_qos: QoSClass,
) -> AdmissionDecision
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 defaultReject(or consult deadline/qos if implemented).Block=>Block.
- If the single incoming item cannot fit under the hard cap (even when
the queue is empty), the item is
§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
impl Clone for EdgePolicy
Source§fn clone(&self) -> EdgePolicy
fn clone(&self) -> EdgePolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EdgePolicy
impl Debug for EdgePolicy
Source§impl PartialEq for EdgePolicy
impl PartialEq for EdgePolicy
impl Copy for EdgePolicy
impl Eq for EdgePolicy
impl StructuralPartialEq for EdgePolicy
Auto Trait Implementations§
impl Freeze for EdgePolicy
impl RefUnwindSafe for EdgePolicy
impl Send for EdgePolicy
impl Sync for EdgePolicy
impl Unpin for EdgePolicy
impl UnsafeUnpin for EdgePolicy
impl UnwindSafe for EdgePolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more