#include <throttling_manager.h>
|
template<class T , class U , class E , typename... ErrorArgs> |
T | MakeCall (std::function< T(const U &request)> api, const U &api_param, std::string api_name, ErrorArgs...error_on_throttling_args) const |
|
void | SetMaxApiTps (const std::string &api, double tps) |
|
This class implements non-blocking client-side throttling; inherit from it and use MakeCall. For usage example see KinesisClientFacade of the kinesis_manager package.
- Note
- typically, the bucket size for each API is unknown to the client, so this implements linear (average) throttling rather than leaky bucket.
Definition at line 32 of file throttling_manager.h.
template<class T , class U , class E , typename... ErrorArgs>
T Aws::Client::ThrottlingManager::MakeCall |
( |
std::function< T(const U &request)> |
api, |
|
|
const U & |
api_param, |
|
|
std::string |
api_name, |
|
|
ErrorArgs... |
error_on_throttling_args |
|
) |
| const |
|
inlineprotected |
MakeCall - API throttling wrapper
- Template Parameters
-
T | API response object, typically Aws::Utils::Outcome. |
U | API request object, e.g. GetRecordsRequest. |
E | the class to be used for the throttling error, e.g. KinesisErrors. |
- Parameters
-
api | The SDK API function to call. |
api_param | parameter to pass along to the API call. |
api_name | name of the API function, e.g. "GetRecords". |
error_on_throttling_args | the arguments required to construct an object of class E. |
- Returns
- T or T(E(error_on_throttling_args)) if additional wait time is needed before making the call.
Definition at line 48 of file throttling_manager.h.
void Aws::Client::ThrottlingManager::SetMaxApiTps |
( |
const std::string & |
api, |
|
|
double |
tps |
|
) |
| |
|
inlineprotected |
Sets the call rate limit for an API.
- Parameters
-
api | name of the API function |
tps | max number of calls per second |
Definition at line 82 of file throttling_manager.h.
std::mutex Aws::Client::ThrottlingManager::api_call_time_mutex_ |
|
mutableprivate |
std::unordered_map<std::string, std::chrono::time_point<std::chrono::steady_clock> > Aws::Client::ThrottlingManager::last_call_time_per_api_ |
|
mutableprivate |
std::unordered_map<std::string, double> Aws::Client::ThrottlingManager::max_api_tps_ |
|
private |
The documentation for this class was generated from the following file: