8#include <aws/core/Core_EXPORTS.h>
9#include <aws/core/client/RetryStrategy.h>
10#include <aws/core/utils/DateTime.h>
35 bool Acquire(
size_t amount = 1,
bool fastFail =
false);
49 size_t requestCount,
bool enabled,
double lastMaxRate,
const Aws::Utils::DateTime& lastThrottleTime);
90 double m_fillRate = 0.0;
92 double m_maxCapacity = 0.0;
94 double m_currentCapacity = 0.0;
98 double m_measuredTxRate = 0.0;
100 double m_lastTxRateBucket = 0.0;
102 size_t m_requestCount = 0;
104 bool m_enabled =
false;
106 double m_lastMaxRate = 0.0;
146 bool m_fastFail =
false;
virtual bool HasSendToken() override
AdaptiveRetryStrategy(long maxAttempts=3)
AdaptiveRetryStrategy(std::shared_ptr< RetryQuotaContainer > retryQuotaContainer, long maxAttempts=3)
const char * GetStrategyName() const override
RetryTokenBucket m_retryTokenBucket
virtual void RequestBookkeeping(const HttpResponseOutcome &httpResponseOutcome) override
virtual void RequestBookkeeping(const HttpResponseOutcome &httpResponseOutcome, const AWSError< CoreErrors > &lastError) override
void UpdateMeasuredRate(const Aws::Utils::DateTime &now=Aws::Utils::DateTime::Now())
void Refill(const Aws::Utils::DateTime &now=Aws::Utils::DateTime::Now())
Aws::Utils::DateTime m_lastTimestamp
double CUBICSuccess(const Aws::Utils::DateTime ×tamp, const double timeWindow) const
std::recursive_mutex m_mutex
bool Acquire(size_t amount=1, bool fastFail=false)
Aws::Utils::DateTime m_lastThrottleTime
void UpdateClientSendingRate(bool throttlingResponse, const Aws::Utils::DateTime &now=Aws::Utils::DateTime::Now())
RetryTokenBucket(double fillRate, double maxCapacity, double currentCapacity, const Aws::Utils::DateTime &lastTimestamp, double measuredTxRate, double lastTxRateBucket, size_t requestCount, bool enabled, double lastMaxRate, const Aws::Utils::DateTime &lastThrottleTime)
double CalculateTimeWindow() const
RetryTokenBucket()=default
void UpdateRate(double newRps, const Aws::Utils::DateTime &now=Aws::Utils::DateTime::Now())
double CUBICThrottle(const double rateToUse) const