Protected Member Functions | Private Attributes | List of all members
Aws::Client::ThrottlingManager Class Reference

#include <throttling_manager.h>

Inheritance diagram for Aws::Client::ThrottlingManager:
Inheritance graph
[legend]

Protected Member Functions

template<class T , class U , class E , typename... ErrorArgs>
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)
 

Private Attributes

std::mutex api_call_time_mutex_
 
std::unordered_map< std::string, std::chrono::time_point< std::chrono::steady_clock > > last_call_time_per_api_
 
std::unordered_map< std::string, double > max_api_tps_
 

Detailed Description

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.

Member Function Documentation

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
TAPI response object, typically Aws::Utils::Outcome.
UAPI request object, e.g. GetRecordsRequest.
Ethe class to be used for the throttling error, e.g. KinesisErrors.
Parameters
apiThe SDK API function to call.
api_paramparameter to pass along to the API call.
api_namename of the API function, e.g. "GetRecords".
error_on_throttling_argsthe 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
apiname of the API function
tpsmax number of calls per second

Definition at line 82 of file throttling_manager.h.

Member Data Documentation

std::mutex Aws::Client::ThrottlingManager::api_call_time_mutex_
mutableprivate

Definition at line 86 of file throttling_manager.h.

std::unordered_map<std::string, std::chrono::time_point<std::chrono::steady_clock> > Aws::Client::ThrottlingManager::last_call_time_per_api_
mutableprivate

Definition at line 88 of file throttling_manager.h.

std::unordered_map<std::string, double> Aws::Client::ThrottlingManager::max_api_tps_
private

Definition at line 85 of file throttling_manager.h.


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


aws_common
Author(s): AWS RoboMaker
autogenerated on Sat Mar 6 2021 03:11:38