CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BackoffThrottle Class Reference

#include <backoff.h>

Inheritance diagram for BackoffThrottle:
Collaboration diagram for BackoffThrottle:

Public Member Functions

 BackoffThrottle ()
 
 BackoffThrottle (const unsigned init_delay_ms, const unsigned max_delay_ms, const unsigned reset_after_ms)
 
 ~BackoffThrottle ()
 
void Throttle ()
 
void Reset ()
 

Static Public Attributes

static const unsigned kDefaultInitDelay = 32
 
static const unsigned kDefaultMaxDelay = 2000
 
static const unsigned kDefaultResetAfter = 10000
 

Private Member Functions

void Init (const unsigned init_delay_ms, const unsigned max_delay_ms, const unsigned reset_after_ms)
 

Private Attributes

unsigned delay_range_
 
unsigned init_delay_ms_
 
unsigned max_delay_ms_
 
unsigned reset_after_ms_
 
time_t last_throttle_
 
Prng prng_
 
pthread_mutex_t * lock_
 

Additional Inherited Members

- Protected Member Functions inherited from SingleCopy
 SingleCopy ()
 

Detailed Description

This file is part of the CernVM File System. When Throttle() is called in quick succession, the exponential backoff will start (sleep). The class forgets a call to Throttle() after reset_after_ms milliseconds.

Definition at line 18 of file backoff.h.

Constructor & Destructor Documentation

BackoffThrottle::BackoffThrottle ( )
inline

Definition at line 27 of file backoff.h.

Here is the call graph for this function:

BackoffThrottle::BackoffThrottle ( const unsigned  init_delay_ms,
const unsigned  max_delay_ms,
const unsigned  reset_after_ms 
)
inline

Definition at line 30 of file backoff.h.

Here is the call graph for this function:

BackoffThrottle::~BackoffThrottle ( )

Definition at line 36 of file backoff.cc.

Member Function Documentation

void BackoffThrottle::Init ( const unsigned  init_delay_ms,
const unsigned  max_delay_ms,
const unsigned  reset_after_ms 
)
private

Definition at line 18 of file backoff.cc.

Referenced by BackoffThrottle().

Here is the call graph for this function:

Here is the caller graph for this function:

void BackoffThrottle::Reset ( )

Definition at line 42 of file backoff.cc.

Referenced by file_watcher::FileWatcher::RegisterFilter().

Here is the caller graph for this function:

void BackoffThrottle::Throttle ( )

Member Data Documentation

unsigned BackoffThrottle::delay_range_
private

Definition at line 44 of file backoff.h.

unsigned BackoffThrottle::init_delay_ms_
private

Definition at line 45 of file backoff.h.

const unsigned BackoffThrottle::kDefaultInitDelay = 32
static

32ms

Definition at line 20 of file backoff.h.

Referenced by BackoffThrottle().

const unsigned BackoffThrottle::kDefaultMaxDelay = 2000
static

Maximum 2 seconds

Definition at line 21 of file backoff.h.

Referenced by BackoffThrottle().

const unsigned BackoffThrottle::kDefaultResetAfter = 10000
static

Clear memory after 10s

Definition at line 25 of file backoff.h.

Referenced by BackoffThrottle().

time_t BackoffThrottle::last_throttle_
private

Definition at line 48 of file backoff.h.

pthread_mutex_t* BackoffThrottle::lock_
private

Definition at line 50 of file backoff.h.

unsigned BackoffThrottle::max_delay_ms_
private

Definition at line 46 of file backoff.h.

Prng BackoffThrottle::prng_
private

Definition at line 49 of file backoff.h.

unsigned BackoffThrottle::reset_after_ms_
private

Definition at line 47 of file backoff.h.


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