My Project: dht::RateLimiter Class Reference

My Project 3.7.7 C++ Distributed Hash Table

Loading...
Searching...
No Matches
Public Member Functions | List of all members
dht::RateLimiter Class Reference

## Public Member Functions
| RateLimiter (size_t quota, const duration &period=std::chrono::seconds(1))
size_t | maintain (const time_point &now)
bool | limit (const time_point &now)
bool | empty () const

## Detailed Description

Definition at line 10 of file rate_limiter.h.

## Constructor & Destructor Documentation

## ◆ RateLimiter()

dht::RateLimiter::RateLimiter | ( | size_t | quota,
|  | const duration & | period = std::chrono::seconds(1) )
| inline

Definition at line 13 of file rate_limiter.h.

## Member Function Documentation

## ◆ empty()

bool dht::RateLimiter::empty | ( |  | ) | const
| inline

Definition at line 36 of file rate_limiter.h.

## ◆ limit()

bool dht::RateLimiter::limit | ( | const time_point & | now | ) |
| inline

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

Definition at line 27 of file rate_limiter.h.

## ◆ maintain()

size_t dht::RateLimiter::maintain | ( | const time_point & | now | ) |
| inline

Clear outdated records and return current quota usage

Definition at line 19 of file rate_limiter.h.

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

- /home/noptrix/ba/blackarch/packages/opendht-c/src/opendht/include/opendht/rate_limiter.h