pub trait EscalationPolicy: Send + Sync {
// Required methods
fn initial_tier(&self) -> EscalationTier;
fn should_escalate(
&self,
ctx: &ResponseContext,
current: EscalationTier,
) -> Option<EscalationTier>;
fn max_tier(&self) -> EscalationTier;
}Expand description
Port trait for tiered request escalation.
Implementations decide:
- Where to start (
initial_tier) - When to move up (
should_escalate) - Where to stop (
max_tier)
The trait is purely synchronous — it contains no I/O. The pipeline executor (see T20) calls into the policy between tiers.
Required Methods§
Sourcefn initial_tier(&self) -> EscalationTier
fn initial_tier(&self) -> EscalationTier
The tier to attempt first.
Sourcefn should_escalate(
&self,
ctx: &ResponseContext,
current: EscalationTier,
) -> Option<EscalationTier>
fn should_escalate( &self, ctx: &ResponseContext, current: EscalationTier, ) -> Option<EscalationTier>
Given a response context and the current tier, return the next tier
to try, or None to accept the current response.
Implementations should respect max_tier: if
current >= self.max_tier(), return None.
Sourcefn max_tier(&self) -> EscalationTier
fn max_tier(&self) -> EscalationTier
The highest tier this policy is allowed to reach.