libfilezilla
Public Member Functions | Friends | List of all members
rate_limit_manager Class Referencefinal

Context for rate_limiters. More...

#include <rate_limiter.hpp>

Inheritance diagram for rate_limit_manager:
Inheritance graph
[legend]
Collaboration diagram for rate_limit_manager:
Collaboration graph
[legend]

Public Member Functions

 rate_limit_manager (event_loop &loop)
 
void add (rate_limiter *limiter)
 Adds a limiter to the manager. More...
 
void set_burst_tolerance (rate::type tolerance)
 Burst tolerance, a multiplier to bucket size, helps achieving the average rate on bursty connections.
 
- Public Member Functions inherited from event_handler
 event_handler (event_loop &loop)
 
 event_handler (event_handler const &h)
 
event_handleroperator= (event_handler const &)=delete
 
void remove_handler ()
 Deactivates handler, removes all pending events and stops all timers for this handler. More...
 
template<typename T , typename... Args>
void send_event (Args &&... args)
 Sends the passed event asynchronously to the handler. More...
 
template<typename T >
void send_event (T *evt)
 
timer_id add_timer (monotonic_clock const &deadline, duration const &interval={})
 Adds a timer, returns the timer id. More...
 
timer_id add_timer (duration const &interval, bool one_shot)
 Adds a timer, returns the timer id. More...
 
void stop_timer (timer_id id)
 
timer_id stop_add_timer (timer_id id, monotonic_clock const &deadline, duration const &interval={})
 
timer_id stop_add_timer (timer_id id, duration const &interval, bool one_shot)
 

Friends

class rate_limiter
 
class bucket_base
 
class bucket
 

Additional Inherited Members

- Public Attributes inherited from event_handler
event_loopevent_loop_
 

Detailed Description

Context for rate_limiters.

Each active

See also
rate_limiter must be added to a rate_limit_manager. The rate_limit_manager must exist longer than the rate_limiters.

This class implements the timer that periodically adds tokens to buckets. This timer is started and stopped automatically, it does not run when there is no activity to avoid unneeded CPU wakeups.

Member Function Documentation

◆ add()

void add ( rate_limiter limiter)

Adds a limiter to the manager.

Gets removed automatically when the limiter is destroyed, or manually when the limiter's remove_bucket is called.


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