pub struct AdaptiveController {
pub quote: Limiter,
pub store: Limiter,
pub fetch: Limiter,
/* private fields */
}Expand description
Bundle of per-channel limiters owned by the Client.
Fields§
§quote: Limiter§store: Limiter§fetch: LimiterImplementations§
Source§impl AdaptiveController
impl AdaptiveController
Sourcepub fn new(start: ChannelStart, config: AdaptiveConfig) -> Self
pub fn new(start: ChannelStart, config: AdaptiveConfig) -> Self
Create a controller with cold-start values per channel.
Sanitizes the config (NaN guards, floor/ceiling enforcement)
before constructing limiters. The supplied start is captured
as the per-instance cold-start floor for warm_start.
Sourcepub fn snapshot(&self) -> ChannelStart
pub fn snapshot(&self) -> ChannelStart
Snapshot current per-channel caps for persistence.
Sourcepub fn config(&self) -> &AdaptiveConfig
pub fn config(&self) -> &AdaptiveConfig
Read-only access to the controller’s adaptive config. Made
read-only deliberately: each Limiter snapshots its own
Arc<LimiterConfig> at construction, so post-hoc mutation
would silently desync warm_start‘s enabled check from
the limiters’ frozen copies.
Sourcepub fn warm_start(&self, snapshot: ChannelStart)
pub fn warm_start(&self, snapshot: ChannelStart)
Apply a previously-saved snapshot as the warm-start cap.
The effective warm value per channel is
max(snapshot, self.cold_start) — flooring at the
per-instance cold-start (NOT the global default) so:
- A prior bad run that pinned cap=1 doesn’t pessimize this run forever.
- A controller built with custom (e.g. low) cold starts for benchmarking is not silently jumped above its construction parameters.
Does not clear sliding windows. When enabled = false, this
is a no-op — fixed-concurrency mode means fixed-concurrency.
Trait Implementations§
Source§impl Clone for AdaptiveController
impl Clone for AdaptiveController
Source§fn clone(&self) -> AdaptiveController
fn clone(&self) -> AdaptiveController
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AdaptiveController
impl Debug for AdaptiveController
Auto Trait Implementations§
impl Freeze for AdaptiveController
impl RefUnwindSafe for AdaptiveController
impl Send for AdaptiveController
impl Sync for AdaptiveController
impl Unpin for AdaptiveController
impl UnsafeUnpin for AdaptiveController
impl UnwindSafe for AdaptiveController
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more