userver
C++ Async Framework
Loading...
Searching...
No Matches
limiter.hpp
1
#
pragma
once
2
3
#
include
<
optional
>
4
#
include
<
vector
>
5
6
#
include
<
userver
/
concurrent
/
variable
.
hpp
>
7
#
include
<
userver
/
congestion_control
/
limiter
.
hpp
>
8
#
include
<
userver
/
utils
/
not_null
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
server::congestion_control {
13
14
class
Limitee
{
15
public
:
16
virtual
void
SetLimit(std::optional<size_t> new_limit) = 0;
17
18
virtual
std::size_t GetLimitableHandlersCount()
const
= 0;
19
};
20
21
class
Limiter
final
:
public
USERVER_NAMESPACE::
congestion_control
::
Limiter
{
22
public
:
23
void
SetLimit(
const
USERVER_NAMESPACE::
congestion_control
::
Limit
& new_limit)
override
;
24
25
std::size_t GetLimitableHandlersCount()
const
;
26
27
void
RegisterLimitee(
Limitee
& limitee);
28
29
private
:
30
concurrent
::Variable<std::vector<
utils
::
NotNull
<
Limitee
*>>, std::mutex> limitees_;
31
};
32
33
}
// namespace server::congestion_control
34
35
USERVER_NAMESPACE_END
userver
server
congestion_control
limiter.hpp
Generated on Wed Apr 1 2026 10:43:20 for userver by
Doxygen
1.13.2