@@ -72,15 +72,15 @@ class ComponentA: components::ComponentBase {
7272```
7373
7474Only components should know about components. Clients and other types
75- constructed by components should not use components::ComponentConfig,
76- components::ComponentContext, or components directly. All the components
77- should inherit from components::ComponentBase base class and may
75+ constructed by components should not use @ref components::ComponentConfig,
76+ @ref components::ComponentContext, or components directly. All the components
77+ should inherit from @ref components::ComponentBase base class and may
7878override its methods.
7979
8080All the components are listed at the @ref userver_components API Group.
8181
8282## Startup context
83- On component construction a components::ComponentContext is passed as a
83+ On component construction a @ref components::ComponentContext is passed as a
8484second parameter to the constructor of the component. That context could
8585be used to get references to other components. That reference to the
8686component is guaranteed to outlive the component that is being constructed.
@@ -89,32 +89,30 @@ component is guaranteed to outlive the component that is being constructed.
8989Please see docs on @ref components::ServiceLifetimeStage.
9090
9191## Components construction and destruction order
92- utils::DaemonMain, components::Run or components::RunOnce
93- start all the components from the passed components::ComponentList.
94- Each component is constructed in a separate engine::Task on the default
92+ @ref utils::DaemonMain, @ref components::Run or @ref components::RunOnce
93+ start all the components from the passed @ref components::ComponentList.
94+ Each component is constructed in a separate @ref engine::Task on the default
9595task processor and is initialized concurrently with other components.
9696
9797This is a useful feature, for example in cases
9898with multiple caches that slowly read from different databases.
9999
100100To make component *A* depend on component *B* just call
101- components::ComponentContext::FindComponent<B>() in the constructor of A.
101+ @ref components::ComponentContext::FindComponent<B>() in the constructor of A.
102102FindComponent() suspends the current task and continues only after the
103103construction of component B is finished. Components are destroyed
104104in reverse order of construction, so the component A is destroyed before
105105the component B. In other words - references from FindComponent() outlive
106106the component that called the FindComponent() function. If any component
107107loading fails, FindComponent() wakes up and throws an
108- components::ComponentsLoadCancelledException.
108+ @ref components::ComponentsLoadCancelledException.
109109
110110@anchor clients_from_components_lifetime
111111## References from components and lifetime of clients
112- It is a common practice to have a component that returns a reference *R* from
113- some function *F*. In such cases:
112+ It is a common practice to have a component that returns a reference *R* from some function *F*. In such cases:
114113* a reference *R* lives as long as the component is alive
115114* a reference *R* is usually a client
116- * and it is safe to invoke member functions of reference *R* concurrently
117- unless otherwise specified.
115+ * and it is safe to invoke member functions of reference *R* concurrently unless otherwise specified.
118116
119117Examples:
120118* components::HttpClient::GetHttpClient()
@@ -123,17 +121,17 @@ Examples:
123121## Components static configuration
124122components::ManagerControllerComponent configures the engine internals from
125123information provided in its static config: preallocates coroutines, creates
126- the engine::TaskProcessor, creates threads for low-level event processing.
124+ the @ref engine::TaskProcessor, creates threads for low-level event processing.
127125After that it starts all the components that
128126were added to the components::ComponentList. Each registered component
129127should have a section in service config (also known as static config).
130128
131129The component configuration is passed as a first parameter of type
132- components::ComponentConfig to the constructor of the component. Note that
133- components::ComponentConfig extends the functionality of
134- yaml_config::YamlConfig with YamlConfig::Mode::kEnvAllowed mode
130+ @ref components::ComponentConfig to the constructor of the component. Note that
131+ @ref components::ComponentConfig extends the functionality of
132+ @ref yaml_config::YamlConfig with @ref YamlConfig::Mode::kEnvAllowed mode
135133that is able to substitute variables with values, use environment variales and
136- fallbacks. See yaml_config::YamlConfig for more info and examples.
134+ fallbacks. See @ref yaml_config::YamlConfig for more info and examples.
137135
138136All the components have the following options:
139137
@@ -197,13 +195,12 @@ the component.
197195You need a component if:
198196* you need a static config
199197* you need to work with other components
200- * you are writing clients (you need a component to be the factory for your
201- clients)
198+ * you are writing clients (you need a component to be the factory for your clients)
202199* you want to subscribe for configs or cache changes
203200
204201### HowTo
205202Start writing your component from adding a header file with a class
206- inherited from components::ComponentBase.
203+ inherited from @ref components::ComponentBase.
207204@snippet components/component_sample_test.hpp Sample user component header
208205
209206In source file write the implementation of the component:
@@ -218,9 +215,9 @@ If you need dynamic configs, you can get them using this approach:
218215@note See @ref scripts/docs/en/userver/tutorial/config_service.md for info on how to
219216implement your own config server.
220217
221- Do not forget to register your component in components::ComponentList
222- before invoking the utils::DaemonMain, components::Run or
223- components::RunOnce.
218+ Do not forget to register your component in @ref components::ComponentList
219+ before invoking the @ref utils::DaemonMain, @ref components::Run or
220+ @ref components::RunOnce.
224221
225222Done! You've implemented your first component. Full sources:
226223* @ref components/component_sample_test.hpp
0 commit comments