MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / update_buckets

Method update_buckets

rate_limiter/src/lib.rs:487–499  ·  view source on GitHub ↗

Updates the parameters of the token buckets associated with this RateLimiter. TODO: Please note that, right now, the buckets become full after being updated.

(&mut self, bytes: BucketUpdate, ops: BucketUpdate)

Source from the content-addressed store, hash-verified

485 /// Updates the parameters of the token buckets associated with this RateLimiter.
486 // TODO: Please note that, right now, the buckets become full after being updated.
487 pub fn update_buckets(&mut self, bytes: BucketUpdate, ops: BucketUpdate) {
488 let guard = self.inner.get_mut().unwrap();
489 match bytes {
490 BucketUpdate::Disabled => guard.bandwidth = None,
491 BucketUpdate::Update(tb) => guard.bandwidth = Some(tb),
492 BucketUpdate::None => (),
493 }
494 match ops {
495 BucketUpdate::Disabled => guard.ops = None,
496 BucketUpdate::Update(tb) => guard.ops = Some(tb),
497 BucketUpdate::None => (),
498 }
499 }
500}
501
502impl AsRawFd for RateLimiter {

Callers 1

test_update_bucketsFunction · 0.80

Calls 1

get_mutMethod · 0.45

Tested by 1

test_update_bucketsFunction · 0.64