A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/corelib_2request__control_8hpp_source.html below:

NCBI C++ ToolKit: include/corelib/request_control.hpp Source File

Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef CORELIB___REQUEST_CONTROL__HPP 2 #define CORELIB___REQUEST_CONTROL__HPP 64

eMinTimeBetweenRequests

130

(

unsigned int

num_requests_allowed,

133

EThrottleAction throttle_action =

eDefault

,

134

EThrottleMode throttle_mode = eContinuous);

157  void

Reset(

unsigned int

num_requests_allowed,

160

EThrottleAction throttle_action =

eDefault

,

161

EThrottleMode throttle_mode = eContinuous);

175  bool

Approve(EThrottleAction action =

eDefault

);

197  static void

Sleep(

CTimeSpan

sleep_time);

202  void Lock

() { Approve(eSleep); }

206  bool IsEnabled

(

void

)

const

{

return

m_NumRequestsAllowed != kNoLimit; }

215  void

x_CleanTimeLine(

TTime

now);

CRequestRateControlException –.

virtual const char * GetErrCodeString(void) const override

Translate from the error code value to its string representation.

EErrCode

Error types that an application can generate.

#define END_NCBI_SCOPE

End previously defined NCBI scope.

#define BEGIN_NCBI_SCOPE

Define ncbi namespace.

unsigned int m_NumRequests

Num requests per period.

EThrottleAction

What to do if exceeded the rate limits.

bool IsEnabled(void) const

Check if throttling is enabled.

EThrottleMode

Throttle mode.

TTime m_MinTimeBetweenRequests

EThrottleAction m_ThrottleAction

CStopWatch m_StopWatch

Stopwatch to measure elapsed time.

CTimeSpan ApproveTime(void)

Get a time span in which request can be approved.

unsigned int m_NumRequestsAllowed

TTimeLine m_TimeLine

Vector of times of approvals.

void Lock()

Lock/unlock functions for use by generic RAII guard CGuard.

bool Approve(EThrottleAction action=eDefault)

Approve a request.

NCBI_EXCEPTION_DEFAULT(CRequestRateControlException, CCoreException)

bool x_Approve(EThrottleAction action, CTimeSpan *sleeptime)

TTime m_LastApproved

Last approve time.

@ eSleep

Sleep till the rate requirements are met & return.

@ eException

Throw an exception.

@ eErrCode

Return immediately with err code == FALSE.

@ eContinuous

Uses float time frame to check number of requests.

@ eNumRequestsPerPeriod

Number of requests per period exceeded;.

@ eNumRequestsMax

Maximum number of requests exceeded;.

#define NCBI_XNCBI_EXPORT

Defines: CTimeFormat - storage class for time format.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4