pub struct Warmed<C> { /* private fields */ }Expand description
The door a run’s requests enter the keep-warm account by: it owns the
adapter a run calls and is itself the Model the turn loop is
handed, so every request that reached the provider is recorded
without the turn loop knowing keep-warm exists.
It forwards every call method of Model rather than inheriting a
default, because a default is correct and only slower: an inherited
call_speculating drops the early calls, and no read then starts
while the model writes (crates/runtime/spec/Prefix.lean D97).
The clock is the caller’s, injected from the one sampling point. The
door measures its endpoint’s Lead from a renewal’s round trip and
from a real call’s first increment, never from a whole call, whose
generation the provider’s lifetime does not wait for (D100).
Implementations§
Source§impl<C: FnMut() -> Result<TimeMs, AxError>> Warmed<C>
impl<C: FnMut() -> Result<TimeMs, AxError>> Warmed<C>
Sourcepub fn new(
model: Box<dyn Model + Send>,
setting: KeepWarm,
clock: C,
lead: Lead,
) -> Warmed<C>
pub fn new( model: Box<dyn Model + Send>, setting: KeepWarm, clock: C, lead: Lead, ) -> Warmed<C>
Wraps model, which reaches the endpoint lead is read for;
under KeepWarm::Off it only forwards.
Sourcepub fn next_due(&self) -> Option<u64>
pub fn next_due(&self) -> Option<u64>
See Warmth::next_due; the lead is the endpoint’s reading now.
Sourcepub fn renew_due(&mut self, now_ms: u64) -> RenewalRound
pub fn renew_due(&mut self, now_ms: u64) -> RenewalRound
Sends every renewal due by now_ms through the adapter this door
owns, and takes each one’s round trip as the endpoint’s lead: a
renewal asks for one token, so its answer follows the prefill.
A clock or adapter failure ends the round as its refusal.
Trait Implementations§
Source§impl<C: FnMut() -> Result<TimeMs, AxError>> Model for Warmed<C>
impl<C: FnMut() -> Result<TimeMs, AxError>> Model for Warmed<C>
Source§fn provider_account(&self) -> Option<ProviderAccountBinding>
fn provider_account(&self) -> Option<ProviderAccountBinding>
Source§fn account_roster(&self) -> Option<AccountRoster>
fn account_roster(&self) -> Option<AccountRoster>
None for an adapter with
no named account. With two accounts or more each entry’s
usable asks the vault, so a caller asks once per round.Source§fn select_account(&mut self, account: &ServerLabel)
fn select_account(&mut self, account: &ServerLabel)
Source§fn prefix_held(&self) -> Option<PrefixHeld>
fn prefix_held(&self) -> Option<PrefixHeld>
crates/kernel/spec/Model.lean
D60); None when it took none. Asked after every attempt, on
success and on failure, by the turn that writes the
prefix_held line; an adapter with no gate answers None.