|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Base interface for rate limiters. More...
#include <resource_manager.h>


Public Member Functions | |
| virtual | ~rate_limiter ()=default |
| virtual bool | try_acquire (size_t count=1)=0 |
| Try to acquire tokens. | |
| template<typename Func > | |
| auto | execute (Func &&func) -> decltype(func()) |
| Execute a function with rate limiting. | |
| virtual const std::string & | get_name () const =0 |
| Get the name of this rate limiter. | |
Base interface for rate limiters.
Definition at line 170 of file resource_manager.h.
|
virtualdefault |
|
inline |
Execute a function with rate limiting.
| Func | Function type that returns common::Result<T> |
| func | Function to execute |
Definition at line 188 of file resource_manager.h.
References get_name(), kcenon::monitoring::resource_exhausted, and try_acquire().

|
pure virtual |
Get the name of this rate limiter.
Implemented in kcenon::monitoring::leaky_bucket_limiter, and kcenon::monitoring::token_bucket_limiter.
Referenced by execute().

|
pure virtual |
Try to acquire tokens.
| count | Number of tokens to acquire |
Implemented in kcenon::monitoring::leaky_bucket_limiter, and kcenon::monitoring::token_bucket_limiter.
Referenced by execute().
