Lines Matching full:bytes

252     Bytes,  enumerator
269 /// Bandwidth (bytes/s) and ops/s limiting can be used at the same time or individually.
308 /// Creates a new Rate Limiter that can limit on both bytes/s and ops/s.
312 /// * `bytes_total_capacity` - the total capacity of the `TokenType::Bytes` token bucket.
315 /// * `bytes_complete_refill_time_ms` - number of milliseconds for the `TokenType::Bytes`
316 /// token bucket to go from zero Bytes to `bytes_total_capacity` Bytes.
323 /// If either bytes/ops *size* or *refill_time* are **zero**, the limiter
387 TokenType::Bytes => guard.bandwidth.as_mut(), in consume()
436 TokenType::Bytes => guard.bandwidth.as_mut(), in manual_replenish()
488 pub fn update_buckets(&mut self, bytes: BucketUpdate, ops: BucketUpdate) { in update_buckets()
490 match bytes { in update_buckets()
671 assert!(l.consume(u64::MAX, TokenType::Bytes)); in test_rate_limiter_default()
699 // rate limiter with limit of 1000 bytes/s and 1000 ops/s in test_rate_limiter_manual_replenish()
702 // consume 123 bytes in test_rate_limiter_manual_replenish()
703 assert!(l.consume(123, TokenType::Bytes)); in test_rate_limiter_manual_replenish()
704 l.manual_replenish(23, TokenType::Bytes); in test_rate_limiter_manual_replenish()
720 // rate limiter with limit of 1000 bytes/s in test_rate_limiter_bandwidth()
731 // do full 1000 bytes in test_rate_limiter_bandwidth()
732 assert!(l.consume(1000, TokenType::Bytes)); in test_rate_limiter_bandwidth()
734 assert!(!l.consume(100, TokenType::Bytes)); in test_rate_limiter_bandwidth()
747 // try and succeed on another 100 bytes this time in test_rate_limiter_bandwidth()
748 assert!(l.consume(100, TokenType::Bytes)); in test_rate_limiter_bandwidth()
761 // bytes/s limiter should be disabled so consume(whatever) should work in test_rate_limiter_ops()
762 assert!(l.consume(u64::MAX, TokenType::Bytes)); in test_rate_limiter_ops()
786 // rate limiter with limit of 1000 bytes/s and 1000 ops/s in test_rate_limiter_full()
794 // do full 1000 bytes in test_rate_limiter_full()
796 // do full 1000 bytes in test_rate_limiter_full()
797 assert!(l.consume(1000, TokenType::Bytes)); in test_rate_limiter_full()
800 // try and fail on another 100 bytes in test_rate_limiter_full()
801 assert!(!l.consume(100, TokenType::Bytes)); in test_rate_limiter_full()
816 // try and succeed on another 100 bytes this time in test_rate_limiter_full()
817 assert!(l.consume(100, TokenType::Bytes)); in test_rate_limiter_full()
827 assert!(l.consume(2500, TokenType::Bytes)); in test_rate_limiter_overconsumption()
847 assert!(l.consume(1500, TokenType::Bytes)); in test_rate_limiter_overconsumption()
857 assert!(!l.consume(100, TokenType::Bytes)); in test_rate_limiter_overconsumption()
867 assert!(!l.consume(100, TokenType::Bytes)); in test_rate_limiter_overconsumption()
874 assert!(l.consume(100, TokenType::Bytes)); in test_rate_limiter_overconsumption()