6#include <userver/congestion_control/limiter.hpp>
7#include <userver/congestion_control/sensor.hpp>
8#include <userver/utils/periodic_task.hpp>
9#include <userver/utils/statistics/fwd.hpp>
11USERVER_NAMESPACE_BEGIN
13namespace congestion_control::
v2 {
16 std::atomic<
bool> is_enabled{
false};
17 std::atomic<
bool> is_fake_mode{
false};
18 std::atomic<int64_t> current_limit{0};
19 std::atomic<int64_t> enabled_epochs{0};
22void DumpMetric(
utils::statistics::Writer& writer,
const Stats& stats);
27 bool fake_mode{
false};
33 virtual ~Controller() =
default;
40 const std::string& GetName()
const;
42 void SetEnabled(
bool enabled);
48 std::optional<size_t> current_limit_;
51 std::string_view LogFakeMode()
const;
53 const std::string name_;
55 congestion_control::
Limiter& limiter_;
58 USERVER_NAMESPACE::
utils::PeriodicTask periodic_;
59 std::atomic<
bool> enabled_{
true};