Struct throttling::token_bucket::TokenBucket
source · pub struct TokenBucket { /* private fields */ }
Implementations§
source§impl TokenBucket
impl TokenBucket
pub fn new( max_cpu_tokens: u64, cur_cpu_tokens: u64, cpu_token_recharge_rate: u64, default_cpu_cost: u64, max_message_tokens: u64, cur_message_tokens: u64, message_token_recharge_rate: u64, default_message_cost: u64 ) -> Self
pub fn full( max_cpu_tokens: u64, cpu_token_recharge_rate: u64, default_cpu_cost: u64, max_message_tokens: u64, message_token_recharge_rate: u64, default_message_cost: u64 ) -> Self
pub fn empty( max_cpu_tokens: u64, cpu_token_recharge_rate: u64, default_cpu_cost: u64, max_message_tokens: u64, message_token_recharge_rate: u64, default_message_cost: u64 ) -> Self
pub fn set_max_throttled_counter(&mut self, max_throttled_counter: u64)
pub fn throttle_default(&mut self) -> ThrottleResult
pub fn throttle( &mut self, cpu_cost: u64, message_size_cost: u64 ) -> ThrottleResult
Trait Implementations§
source§impl FromStr for TokenBucket
impl FromStr for TokenBucket
Auto Trait Implementations§
impl RefUnwindSafe for TokenBucket
impl Send for TokenBucket
impl Sync for TokenBucket
impl Unpin for TokenBucket
impl UnwindSafe for TokenBucket
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