userver: userver/components/component_fwd.hpp Source File
Loading...
Searching...
No Matches
component_fwd.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/components/component_fwd.hpp
4/// @brief Forward declarations for components::ComponentContext and
5/// components::ComponentConfig; function components::GetCurrentComponentName() and components::GetFsTaskProcessor().
6
7#include <string_view>
8
9#include <userver/engine/task/task_processor_fwd.hpp>
10#include <userver/utils/resource_scopes_fwd.hpp>
11
12USERVER_NAMESPACE_BEGIN
13
14namespace components {
15
16template <typename T>
17struct WithType;
18
19class ComponentConfig;
20
21class ComponentContext;
22
23/// @brief Equivalent to @ref components::ComponentContext::GetComponentName, but works with forward declaration of
24/// the @ref components::ComponentContext.
25std::string_view GetCurrentComponentName(const ComponentContext& context);
26
27/// @brief Equivalent to @ref components::ComponentContext::Scopes, but works with forward declaration of
28/// the @ref components::ComponentContext.
29utils::ResourceScopeStorage& GetResourceScopes(const ComponentContext& context);
30
31/// @brief Returns the `config["fs-task-processor"]` if it is set; otherwise returns the default blocking
32/// task processor that was set in components::ManagerControllerComponent.
33engine::TaskProcessor& GetFsTaskProcessor(const ComponentConfig& config, const ComponentContext& context);
34
35} // namespace components
36
37USERVER_NAMESPACE_END