userver
C++ Async Framework
Loading...
Searching...
No Matches
state.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/components/state.hpp
4
/// @brief @copybrief components::State
5
6
#
include
<
string
>
7
#
include
<
string_view
>
8
#
include
<
unordered_set
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
components
{
13
14
class
ComponentContext;
15
16
namespace
impl {
17
class
ComponentContextImpl;
18
}
19
20
/// State of components that is usable after the components constructor and
21
/// until all the components were not destroyed.
22
///
23
/// @see components::ComponentContext
24
class
State
final
{
25
public
:
26
explicit
State(
const
ComponentContext& cc)
noexcept
;
27
28
/// @returns true if one of the components is in fatal state and can not
29
/// work. A component is in fatal state if the
30
/// components::ComponentHealth::kFatal value is returned from the overridden
31
/// components::ComponentBase::GetComponentHealth().
32
bool
IsAnyComponentInFatalState
()
const
;
33
34
/// @returns true if component with name `component_name` depends
35
/// (directly or transitively) on a component with name `dependency`.
36
///
37
/// Component with name `component_name` should be loaded.
38
/// Components construction should finish before any call to this function
39
/// is made.
40
///
41
/// Note that GetAllDependencies usually is more effective, if you are
42
/// planning multiple calls for the same component name.
43
bool
HasDependencyOn
(std::string_view component_name, std::string_view dependency)
const
;
44
45
/// @returns all the components that `component_name` depends on directly or
46
/// transitively.
47
///
48
/// Component with name `component_name` should be loaded.
49
/// Components construction should finish before any call to this function
50
/// is made. The result should now outlive the all the components
51
/// destruction.
52
std
::
unordered_set
<
std
::
string_view
>
GetAllDependencies
(
std
::
string_view
component_name
)
const
;
53
54
private
:
55
const
impl::ComponentContextImpl& impl_;
56
};
57
58
}
// namespace components
59
60
USERVER_NAMESPACE_END
userver
components
state.hpp
Generated on Wed Dec 4 2024 18:42:23 for userver by
Doxygen
1.10.0