pub struct Watchdog { /* private fields */ }Expand description
One watchdog per run: it holds the correction history, the ceiling the person set on retries, and the account round of the model call in flight.
Implementations§
Source§impl Watchdog
impl Watchdog
pub fn new(retries: Retries, run: RunId) -> Watchdog
Sourcepub fn on_stall(&mut self, verdict: &StallVerdict) -> Disposal
pub fn on_stall(&mut self, verdict: &StallVerdict) -> Disposal
Consumes the stall verdict verbatim. First hit: a corrective steer naming the repetition. Second hit: freeze.
Sourcepub fn open_round(
&mut self,
roster: Option<AccountRoster>,
) -> Result<Option<ServerLabel>, AxError>
pub fn open_round( &mut self, roster: Option<AccountRoster>, ) -> Result<Option<ServerLabel>, AxError>
Opens the account round of the next model call, before its first send, from the roster the adapter answers. The round’s opening account is the roster’s current one while it is redeemable, which on a run’s first call is the Session’s binding.
Answers the account the call must go out on, which the caller
selects on the model before sending; None for a single-account
round, which names none.
§Errors
E_PROVIDER_ACCOUNTS_EXHAUSTED when no listed account can be
redeemed: nothing is sent, and no round is open.
Sourcepub fn round_open(&self) -> bool
pub fn round_open(&self) -> bool
Whether a model call’s round is open: between an answer and the next call there is none, and the caller opens one.
Sourcepub fn on_provider_failure(
&mut self,
failure: &AxError,
now: TimeMs,
) -> Disposal
pub fn on_provider_failure( &mut self, failure: &AxError, now: TimeMs, ) -> Disposal
Disposes of one provider failure by the step the call’s account
round gives (kernel D54). The producer of the error already
decided whether the same call is worth making again and whether
the account can still take it, so this reads AxError::retry and
AxError::account through the round rather than guessing.
With one account, Retry::No freezes on the first one: repeating
a request the provider rejected on its shape buys the same
rejection again. Yes and Unknown back off (a model call’s only
effect is an answer the city never received) from now by the
schedule backoff_ms holds, or by the provider’s own
retry_after_ms when that is longer: asking before the time it
named buys one more refusal. With several accounts a resend backs
off the same way, a switch goes at once and starts the schedule
over, and a round with no account left freezes as
FreezeReason::AccountsExhausted.
A retriable failure freezes only against a ceiling the person
set. Under Retries::UntilHalted what stops a run that keeps
failing is Halt, the city’s one brake; under
Retries::AtMost it is the number they entered, because a
number entered on a form that nothing reads is worse than no
field at all. A failure outside an open round meets a
single-account round opened for it.
Sourcepub fn on_provider_answered(&mut self)
pub fn on_provider_answered(&mut self)
The provider answered, which ends the streak of failures and the call’s account round.
Sourcepub fn admits_repair(&self) -> bool
pub fn admits_repair(&self) -> bool
Whether the turn’s repair segment may send the failed call again through the blocking door: with several accounts that is one more send on the current account, inside its budget and the person’s ceiling. Outside an open round it may, as it always could.
Sourcepub fn repaired(&mut self)
pub fn repaired(&mut self)
The repair segment sent the call again: counted on the current account when the round has several.
Sourcepub fn exhausted(&self) -> AxError
pub fn exhausted(&self) -> AxError
The failure a run records when every account of its provider failed: the provider, and each account with the last failure it met in the round, or that its reference could not be redeemed. Neither a key nor a reference is in it.
Sourcepub fn fired_payload(&self, disposal: &Disposal) -> Result<Payload, AxError>
pub fn fired_payload(&self, disposal: &Disposal) -> Result<Payload, AxError>
The watchdog_fired payload (E_LOOP_SUSPECTED’s carrier when the
reason is a stall). Proceed never fires.
§Errors
E_INVALID_ARGS for Disposal::Proceed, which records
nothing, and whatever Payload::of says about the encoding.