AWS SDK for C++

AWS SDK for C++ Version 1.11.790

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES > Class Template Reference

#include <DefaultRateLimiter.h>

Inheritance diagram for Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >:
[legend]

Public Types

 
using InternalTimePointType = std::chrono::time_point< CLOCK >
 
 
using DelayType = std::chrono::milliseconds
 

Public Member Functions

 DefaultRateLimiter (int64_t maxRate, ElapsedTimeFunctionType elapsedTimeFunction=CLOCK::now)
 
virtual ~DefaultRateLimiter ()=default
 
virtual DelayType ApplyCost (int64_t cost) override
 
virtual void ApplyAndPayForCost (int64_t cost) override
 
virtual void SetRate (int64_t rate, bool resetAccumulator=false) override
 

Public Member Functions inherited from Aws::Utils::RateLimits::RateLimiterInterface

 

Detailed Description

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
class Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >

High precision rate limiter. If you need to limit your bandwidth by a budget, this is very likely the implementation you want.

Definition at line 23 of file DefaultRateLimiter.h.

Member Typedef Documentation

◆ Base

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
using Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >::Base = RateLimiterInterface

Definition at line 25 of file DefaultRateLimiter.h.

◆ ElapsedTimeFunctionType

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
using Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >::ElapsedTimeFunctionType = std::function<InternalTimePointType()>

Definition at line 28 of file DefaultRateLimiter.h.

◆ InternalTimePointType

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
using Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >::InternalTimePointType = std::chrono::time_point<CLOCK>

Definition at line 27 of file DefaultRateLimiter.h.

Constructor & Destructor Documentation

◆ DefaultRateLimiter()

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >::DefaultRateLimiter ( int64_t  maxRate,
ElapsedTimeFunctionType  elapsedTimeFunction = CLOCK::now 
)
inline

Initializes state, starts counts, does some basic validation.

Definition at line 33 of file DefaultRateLimiter.h.

◆ ~DefaultRateLimiter()

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
virtual Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >::~DefaultRateLimiter ( )
virtualdefault

Member Function Documentation

◆ ApplyAndPayForCost()

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
virtual void Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >::ApplyAndPayForCost ( int64_t  cost)
inlineoverridevirtual

Same as ApplyCost() but then goes ahead and sleeps the current thread.

Implements Aws::Utils::RateLimits::RateLimiterInterface.

Definition at line 99 of file DefaultRateLimiter.h.

◆ ApplyCost()

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
virtual DelayType Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >::ApplyCost ( int64_t  cost)
inlineoverridevirtual

Calculates time in milliseconds that should be delayed before letting anymore data through.

Implements Aws::Utils::RateLimits::RateLimiterInterface.

Definition at line 58 of file DefaultRateLimiter.h.

◆ SetRate()

template<typename CLOCK = std::chrono::steady_clock, typename DUR = std::chrono::seconds, bool RENORMALIZE_RATE_CHANGES = true>
virtual void Aws::Utils::RateLimits::DefaultRateLimiter< CLOCK, DUR, RENORMALIZE_RATE_CHANGES >::SetRate ( int64_t  rate,
bool  resetAccumulator = false 
)
inlineoverridevirtual

Update the bandwidth rate to allow.

Implements Aws::Utils::RateLimits::RateLimiterInterface.

Definition at line 109 of file DefaultRateLimiter.h.


The documentation for this class was generated from the following file: