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