Return whether the given limits are preserved exactly by this class.

Synopsis

Declared in <balb_ratelimiter.h>

static
bool
supportsRateLimitsExactly(
    bsls::Types::Uint64 sustainedRateLimit,
    bsls::TimeInterval const& sustainedRateWindow,
    bsls::Types::Uint64 peakRateLimit,
    bsls::TimeInterval const& peakRateWindow);

Description

Returns true if, supposing the specified sustainedRateLimit, sustainedRateWindow, peakRateLimit, and peakRateWindow are used to initialize a RateLimiter object, the corresponding query methods return the same values. The implementation of RateLimiter uses balb::LeakyBucket objects, and for some combinations of values the capacity of the balb::LeakyBucket is rounded such that the rederived values differ. Note that this method is most likely to return true when the product of each corresponding pair of limit and window (as a fraction of a second) is integral.

Return Value

true if a limiter initialized with these limits would report the same values from its query methods

Parameters

Name

Description

sustainedRateLimit

sustained rate in units per second

sustainedRateWindow

sustained‐rate time‐window

peakRateLimit

peak rate in units per second

peakRateWindow

peak‐rate time‐window

Created with MrDocs