Twitch SDK (Internal)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ttv::RetryBackoffTable Class Reference

#include <timer.h>

Public Member Functions

 RetryBackoffTable ()
 
 RetryBackoffTable (const std::vector< uint64_t > &tableMilliseconds, uint64_t retryJitterWidthMs)
 
 RetryBackoffTable (uint64_t maxInterval, uint64_t retryJitterWidthMs)
 
void Advance ()
 
void Reset ()
 
uint64_t GetInterval () const
 

Private Member Functions

void CreateTable (uint64_t maxInterval)
 

Private Attributes

std::vector< uint64_t > mBackOffTableMilliseconds
 
uint64_t mJitterMilliseconds
 
uint32_t mNextAttemptNumber
 

Detailed Description

Maintains a table of intervals used to manage the backoff that should be done when retrying requests to a failing endpoint. Usage: Create the table with the desired backoff. When the timed operation succeeds, call Reset() to reset the internal backoff. When the timed operation fails, call GetInterval() to start your timer and call Advance() so the next call to GetInterval() will use the next interval.

Constructor & Destructor Documentation

◆ RetryBackoffTable() [1/3]

ttv::RetryBackoffTable::RetryBackoffTable ( )

Creates a default table with default jitter.

◆ RetryBackoffTable() [2/3]

ttv::RetryBackoffTable::RetryBackoffTable ( const std::vector< uint64_t > &  tableMilliseconds,
uint64_t  retryJitterWidthMs 
)

Uses an explicit table and jitter.

◆ RetryBackoffTable() [3/3]

ttv::RetryBackoffTable::RetryBackoffTable ( uint64_t  maxInterval,
uint64_t  retryJitterWidthMs 
)

Computes an exponential backoff table and uses the given jitter.

Member Function Documentation

◆ Advance()

void ttv::RetryBackoffTable::Advance ( )

Advance to the next retry interval.

◆ CreateTable()

void ttv::RetryBackoffTable::CreateTable ( uint64_t  maxInterval)
private

◆ GetInterval()

uint64_t ttv::RetryBackoffTable::GetInterval ( ) const

Gets the next timer interval to use.

◆ Reset()

void ttv::RetryBackoffTable::Reset ( )

Reset the retry attempt index.

Member Data Documentation

◆ mBackOffTableMilliseconds

std::vector<uint64_t> ttv::RetryBackoffTable::mBackOffTableMilliseconds
private

◆ mJitterMilliseconds

uint64_t ttv::RetryBackoffTable::mJitterMilliseconds
private

◆ mNextAttemptNumber

uint32_t ttv::RetryBackoffTable::mNextAttemptNumber
private

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