userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
dump_control.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/testsuite/dump_control.hpp
4
/// @brief @copybrief testsuite::DumpControl
5
6
#
include
<
string
>
7
#
include
<
unordered_map
>
8
#
include
<
vector
>
9
10
#
include
<
userver
/
components
/
component_fwd
.
hpp
>
11
#
include
<
userver
/
concurrent
/
variable
.
hpp
>
12
#
include
<
userver
/
utils
/
not_null
.
hpp
>
13
#
include
<
userver
/
utils
/
resource_scopes_fwd
.
hpp
>
14
15
USERVER_NAMESPACE_BEGIN
16
17
namespace
testsuite {
18
19
/// @brief Testsuite-facing API of a dump manager.
20
class
Dumper
{
21
public
:
22
virtual
~Dumper();
23
24
virtual
const
std::string& Name()
const
= 0;
25
26
virtual
void
WriteDumpSyncDebug() = 0;
27
28
virtual
void
ReadDumpDebug() = 0;
29
};
30
31
/// @brief Dumper control interface for testsuite
32
/// @details All methods are coro-safe.
33
class
DumpControl
final
{
34
public
:
35
enum
class
PeriodicsMode { kDisabled, kEnabled };
36
37
explicit
DumpControl(PeriodicsMode periodics_mode);
38
39
PeriodicsMode GetPeriodicsMode()
const
;
40
41
void
WriteCacheDumps(
const
std::vector<std::string>& dumper_names);
42
43
void
ReadCacheDumps(
const
std::vector<std::string>& dumper_names);
44
45
/// @brief Registers a dumper bound to @a scopes.
46
///
47
/// The dumper is registered after construction of the object that owns
48
/// @a scopes and is unregistered just before that object is destroyed.
49
void
RegisterScope
(
utils
::ResourceScopeStorage& scopes,
Dumper
& dumper);
50
51
private
:
52
void
RegisterDumper(
Dumper
& dumper);
53
54
void
UnregisterDumper(
Dumper
& dumper)
noexcept
;
55
56
Dumper
& FindDumper(
const
std::string& name)
const
;
57
58
PeriodicsMode periodics_mode_;
59
concurrent
::Variable<std::unordered_map<std::string,
utils
::
NotNull
<
Dumper
*>>> dumpers_;
60
};
61
62
}
// namespace testsuite
63
64
USERVER_NAMESPACE_END
userver
testsuite
dump_control.hpp
Generated on
for userver by
Doxygen
1.17.0