My Project 1.7.4
C++ Distributed Hash Table
Public Member Functions | List of all members
dht::RateLimiter< Quota, Period > Class Template Reference

Public Member Functions

size_t maintain (const time_point &now)
 
bool limit (const time_point &now)
 
bool empty () const
 

Detailed Description

template<size_t Quota, unsigned long Period = 1>
class dht::RateLimiter< Quota, Period >

Definition at line 27 of file rate_limiter.h.

Member Function Documentation

◆ empty()

template<size_t Quota, unsigned long Period = 1>
bool dht::RateLimiter< Quota, Period >::empty ( ) const
inline

Definition at line 43 of file rate_limiter.h.

◆ limit()

template<size_t Quota, unsigned long Period = 1>
bool dht::RateLimiter< Quota, Period >::limit ( const time_point &  now)
inline

Return false if quota is reached, insert record and return true otherwise.

Definition at line 37 of file rate_limiter.h.

◆ maintain()

template<size_t Quota, unsigned long Period = 1>
size_t dht::RateLimiter< Quota, Period >::maintain ( const time_point &  now)
inline

Clear outdated records and return current quota usage

Definition at line 30 of file rate_limiter.h.


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