8#ifndef INCLUDED_BALB_RATELIMITER
9#define INCLUDED_BALB_RATELIMITER
327#include <balscm_version.h>
335#include <bsl_algorithm.h>
336#include <bsl_climits.h>
338#include <bsl_c_limits.h>
577 d_peakRateBucket.
reserve(numUnits);
578 d_sustainedRateBucket.
reserve(numUnits);
584 d_peakRateBucket.
reset(currentTime);
585 d_sustainedRateBucket.
reset(currentTime);
601 ULLONG_MAX - d_sustainedRateBucket.
unitsInBucket()- numUnits);
609 d_peakRateBucket.
submit(numUnits);
610 d_sustainedRateBucket.
submit(numUnits);
649 d_sustainedRateBucket.
getStatistics(submittedUnits, unusedUnits);
681 return d_sustainedRateBucket.
drainRate();
Definition balb_leakybucket.h:421
void submitReserved(bsls::Types::Uint64 numUnits)
Definition balb_leakybucket.h:714
bsls::Types::Uint64 unitsInBucket() const
Return the number of submitted units in this leaky bucket.
Definition balb_leakybucket.h:749
void submit(bsls::Types::Uint64 numUnits)
Definition balb_leakybucket.h:699
void reserve(bsls::Types::Uint64 numUnits)
Definition balb_leakybucket.h:666
bsls::TimeInterval lastUpdateTime() const
Return the time interval when this leaky bucket was last updated.
Definition balb_leakybucket.h:737
void reset(const bsls::TimeInterval ¤tTime)
Definition balb_leakybucket.h:680
void getStatistics(bsls::Types::Uint64 *submittedUnits, bsls::Types::Uint64 *unusedUnits) const
bool wouldOverflow(const bsls::TimeInterval ¤tTime)
bsls::TimeInterval statisticsCollectionStartTime() const
Definition balb_leakybucket.h:743
void updateState(const bsls::TimeInterval ¤tTime)
static bsls::TimeInterval calculateTimeWindow(bsls::Types::Uint64 drainRate, bsls::Types::Uint64 capacity)
bsls::Types::Uint64 unitsReserved() const
Return the number of reserved units in this leaky bucket.
Definition balb_leakybucket.h:755
bsls::Types::Uint64 drainRate() const
Return the drain rate of this leaky bucket.
Definition balb_leakybucket.h:731
bsls::Types::Uint64 capacity() const
Return the capacity of this leaky bucket.
Definition balb_leakybucket.h:725
void cancelReserved(bsls::Types::Uint64 numUnits)
Definition balb_leakybucket.h:653
void resetStatistics()
Definition balb_leakybucket.h:691
Definition balb_ratelimiter.h:379
void setRateLimits(bsls::Types::Uint64 sustainedRateLimit, const bsls::TimeInterval &sustainedRateWindow, bsls::Types::Uint64 peakRateLimit, const bsls::TimeInterval &peakRateWindow)
void reset(const bsls::TimeInterval ¤tTime)
Definition balb_ratelimiter.h:582
static bool supportsRateLimitsExactly(bsls::Types::Uint64 sustainedRateLimit, const bsls::TimeInterval &sustainedRateWindow, bsls::Types::Uint64 peakRateLimit, const bsls::TimeInterval &peakRateWindow)
bsls::Types::Uint64 unitsReserved() const
Return the number of reserved units for this rate limiter.
Definition balb_ratelimiter.h:692
void getStatistics(bsls::Types::Uint64 *submittedUnits, bsls::Types::Uint64 *unusedUnits) const
Definition balb_ratelimiter.h:641
bsls::TimeInterval sustainedRateWindow() const
Definition balb_ratelimiter.h:685
~RateLimiter()
Destroy this object.
bsls::TimeInterval statisticsCollectionStartTime() const
Definition balb_ratelimiter.h:673
bsls::TimeInterval lastUpdateTime() const
Return the time when this rate limiter was last updated.
Definition balb_ratelimiter.h:653
bsls::TimeInterval peakRateWindow() const
Definition balb_ratelimiter.h:666
bsls::TimeInterval calculateTimeToSubmit(const bsls::TimeInterval ¤tTime)
bool wouldExceedBandwidth(const bsls::TimeInterval ¤tTime)
Definition balb_ratelimiter.h:633
void updateState(const bsls::TimeInterval ¤tTime)
Definition balb_ratelimiter.h:626
void resetStatistics()
Definition balb_ratelimiter.h:589
void cancelReserved(bsls::Types::Uint64 numUnits)
Definition balb_ratelimiter.h:558
void submitReserved(bsls::Types::Uint64 numUnits)
Definition balb_ratelimiter.h:614
bsls::Types::Uint64 sustainedRateLimit() const
Return the sustained rate of this rate limiter.
Definition balb_ratelimiter.h:679
void submit(bsls::Types::Uint64 numUnits)
Definition balb_ratelimiter.h:595
RateLimiter(bsls::Types::Uint64 sustainedRateLimit, const bsls::TimeInterval &sustainedRateWindow, bsls::Types::Uint64 peakRateLimit, const bsls::TimeInterval &peakRateWindow, const bsls::TimeInterval ¤tTime)
void reserve(bsls::Types::Uint64 numUnits)
Definition balb_ratelimiter.h:567
bsls::Types::Uint64 peakRateLimit() const
Return the peak rate of this rate limiter.
Definition balb_ratelimiter.h:660
Definition bsls_timeinterval.h:301
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition balb_controlmanager.h:133
unsigned long long Uint64
Definition bsls_types.h:137