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
11USERVER_NAMESPACE_BEGIN
12
13namespace components {
14
15template <typename T>
16struct WithType;
17
18class ComponentConfig;
19
20class ComponentContext;
21
22/// @brief Equivalent to @ref components::ComponentContext::GetComponentName, but works with forward declaration of
23/// the @ref components::ComponentContext.
24std::string_view GetCurrentComponentName(const ComponentContext& context);
25
26/// @brief Returns the `config["fs-task-processor"]` if it is set; otherwise returns the default blocking
27/// task processor that was set in components::ManagerControllerComponent.
28engine::TaskProcessor& GetFsTaskProcessor(const ComponentConfig& config, const ComponentContext& context);
29
30} // namespace components
31
32USERVER_NAMESPACE_END