userver: components::State Class Reference
Loading...
Searching...
No Matches
components::State Class Referencefinal

#include <userver/components/state.hpp>

Detailed Description

State of components that is usable after the components constructor and until all the components were not destroyed.

See also
components::ComponentContext

Definition at line 24 of file state.hpp.

Public Member Functions

 State (const ComponentContext &cc) noexcept
 
bool IsAnyComponentInFatalState () const
 
bool HasDependencyOn (std::string_view component_name, std::string_view dependency) const
 
std::unordered_set< std::string_view > GetAllDependencies (std::string_view component_name) const
 

Member Function Documentation

◆ GetAllDependencies()

std::unordered_set< std::string_view > components::State::GetAllDependencies ( std::string_view component_name) const
Returns
all the components that component_name depends on directly or transitively.

Component with name component_name should be loaded. Components construction should finish before any call to this function is made. The result should now outlive the all the components destruction.

◆ HasDependencyOn()

bool components::State::HasDependencyOn ( std::string_view component_name,
std::string_view dependency ) const
Returns
true if component with name component_name depends (directly or transitively) on a component with name dependency.

Component with name component_name should be loaded. Components construction should finish before any call to this function is made.

Note that GetAllDependencies usually is more effective, if you are planning multiple calls for the same component name.

◆ IsAnyComponentInFatalState()

bool components::State::IsAnyComponentInFatalState ( ) const
Returns
true if one of the components is in fatal state and can not work. A component is in fatal state if the components::ComponentHealth::kFatal value is returned from the overridden components::LoggableComponentBase::GetComponentHealth().

The documentation for this class was generated from the following file: