16class TokenBucket
final {
18 using TimePoint = std::chrono::steady_clock::time_point;
19 using Duration = std::chrono::steady_clock::duration;
38 [[deprecated]]
TokenBucket(size_t max_size, Duration single_token_update_interval);
43 TokenBucket(
const TokenBucket&) =
delete;
44 TokenBucket(TokenBucket&&)
noexcept;
45 TokenBucket& operator=(
const TokenBucket&) =
delete;
46 TokenBucket& operator=(TokenBucket&&)
noexcept;
48 bool IsUnbounded()
const;
93 std::atomic<size_t> max_size_;
94 std::atomic<size_t> token_refill_amount_;
95 std::atomic<Duration> token_refill_interval_;
96 std::atomic<size_t> tokens_;
97 std::atomic<TimePoint> last_update_;