pub trait LoadShedPolicy: Send + Sync {
// Required method
fn decide(
&self,
class: RequestClass,
snap: &PressureSnapshot,
) -> ShedDecision;
// Provided method
fn pressure_active(&self) -> bool { ... }
}Expand description
A pluggable overload-protection policy. decide is pure over the snapshot
so it is unit-testable without a running node; the node wiring layer selects
the implementation from config.
Required Methods§
Sourcefn decide(&self, class: RequestClass, snap: &PressureSnapshot) -> ShedDecision
fn decide(&self, class: RequestClass, snap: &PressureSnapshot) -> ShedDecision
Judge one request against a single pressure sample.
Provided Methods§
Sourcefn pressure_active(&self) -> bool
fn pressure_active(&self) -> bool
Whether the policy currently considers the node pressured. Drives the
load_shed_pressure_active gauge; defaults to false for policies with
no pressure notion (e.g. AlwaysAdmit).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".