userver: userver/components/component_fwd.hpp Source File
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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
15class ComponentConfig;
16
17class ComponentContext;
18
19/// @brief Equivalent to @ref components::ComponentContext::GetComponentName, but works with forward declaration of
20/// the @ref components::ComponentContext.
21std::string_view GetCurrentComponentName(const ComponentContext& context);
22
23/// @brief Returns the `config["fs-task-processor"]` if it is set; otherwise returns the default blocking
24/// task processor that was set in components::ManagerControllerComponent.
25engine::TaskProcessor& GetFsTaskProcessor(const ComponentConfig& config, const ComponentContext& context);
26
27} // namespace components
28
29USERVER_NAMESPACE_END