pub struct AdaptiveRateLimiter { /* private fields */ }Expand description
Adaptive rate limiter
Implementations§
Source§impl AdaptiveRateLimiter
impl AdaptiveRateLimiter
Sourcepub fn new(config: AdaptiveRateLimitConfig) -> Self
pub fn new(config: AdaptiveRateLimitConfig) -> Self
Create new adaptive rate limiter
Sourcepub fn check_adaptive_limit(&self, tenant_id: &str) -> Result<RateLimitResult>
pub fn check_adaptive_limit(&self, tenant_id: &str) -> Result<RateLimitResult>
Check rate limit with adaptive adjustment
Sourcepub fn update_adaptive_limits(&self) -> Result<()>
pub fn update_adaptive_limits(&self) -> Result<()>
Update adaptive limits based on learned patterns
Sourcepub fn predict_and_adjust(&self, tenant_id: &str) -> Result<u32>
pub fn predict_and_adjust(&self, tenant_id: &str) -> Result<u32>
Predict future load and adjust proactively
Sourcepub fn record_system_load(&self, load: SystemLoad)
pub fn record_system_load(&self, load: SystemLoad)
Record system load for load-based adjustments
Sourcepub fn get_tenant_stats(&self, tenant_id: &str) -> Option<AdaptiveLimitStats>
pub fn get_tenant_stats(&self, tenant_id: &str) -> Option<AdaptiveLimitStats>
Get statistics for a tenant
Sourcepub fn get_stats(&self) -> AdaptiveRateLimiterStats
pub fn get_stats(&self) -> AdaptiveRateLimiterStats
Get overall statistics
Auto Trait Implementations§
impl Freeze for AdaptiveRateLimiter
impl !RefUnwindSafe for AdaptiveRateLimiter
impl Send for AdaptiveRateLimiter
impl Sync for AdaptiveRateLimiter
impl Unpin for AdaptiveRateLimiter
impl !UnwindSafe for AdaptiveRateLimiter
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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