7#include <unordered_map>
10#include <userver/components/component_fwd.hpp>
11#include <userver/concurrent/variable.hpp>
12#include <userver/dump/dumper.hpp>
13#include <userver/utils/not_null.hpp>
15USERVER_NAMESPACE_BEGIN
21class DumpControl
final {
23 enum class PeriodicsMode { kDisabled, kEnabled };
25 explicit DumpControl(PeriodicsMode periodics_mode);
27 PeriodicsMode GetPeriodicsMode()
const;
29 void WriteCacheDumps(
const std::vector<std::string>& dumper_names);
31 void ReadCacheDumps(
const std::vector<std::string>& dumper_names);
34 friend class DumperRegistrationHolder;
36 void RegisterDumper(
dump::Dumper& dumper);
38 void UnregisterDumper(
dump::Dumper& dumper);
40 dump::Dumper& FindDumper(
const std::string& name)
const;
42 PeriodicsMode periodics_mode_;
44 std::unordered_map<std::string, utils::NotNull<dump::Dumper*>>>
49class DumperRegistrationHolder
final {
51 DumperRegistrationHolder(DumpControl&,
dump::Dumper&);
53 DumperRegistrationHolder(DumperRegistrationHolder&&) =
delete;
54 DumperRegistrationHolder& operator=(DumperRegistrationHolder&&) =
delete;
55 ~DumperRegistrationHolder();
58 DumpControl& control_;
59 dump::Dumper& dumper_;