Skip to content

Commit f5bca75

Browse files
committed
feat core: move schemas to separate files
Tests: протестировано CI commit_hash:dc19719d354345ff6f7a0649f42be0f8a4eae445
1 parent b7a0cbd commit f5bca75

File tree

86 files changed

+1598
-1311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1598
-1311
lines changed

.mapping.json

Lines changed: 42 additions & 0 deletions
Large diffs are not rendered by default.

core/CMakeLists.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,57 @@ if(TARGET Boost::endian)
116116
)
117117
endif()
118118

119+
list(APPEND EMBED_FILES
120+
src/baggage/baggage_manager.yaml
121+
src/cache/caching_component_base.yaml
122+
src/cache/lru_cache_component_base.yaml
123+
src/clients/http/component.yaml
124+
src/clients/http/component_core.yaml
125+
src/clients/http/plugins/retry_budget/component.yaml
126+
src/components/dump_configurator.yaml
127+
src/components/fs_cache.yaml
128+
src/components/logging_configurator.yaml
129+
src/components/process_starter.yaml
130+
src/components/single_threaded_task_processors.yaml
131+
src/components/statistics_storage.yaml
132+
src/components/tcp_acceptor_base.yaml
133+
src/congestion_control/component.yaml
134+
src/dump/dumper.yaml
135+
src/dynamic_config/client/component.yaml
136+
src/dynamic_config/storage/component.yaml
137+
src/dynamic_config/updater/component.yaml
138+
src/engine/task_processors_load_monitor.yaml
139+
src/logging/component.yaml
140+
src/middlewares/pipeline.yaml
141+
src/server/component.yaml
142+
src/server/handlers/auth/auth_checker_settings_component.yaml
143+
src/server/handlers/auth/digest/auth_checker_settings_component.yaml
144+
src/server/handlers/auth/digest/nonce_cache_settings_component.yaml
145+
src/server/handlers/dynamic_debug_log.yaml
146+
src/server/handlers/handler_base.yaml
147+
src/server/handlers/http_handler_base.yaml
148+
src/server/handlers/http_handler_static.yaml
149+
src/server/handlers/implicit_options.yaml
150+
src/server/handlers/ping.yaml
151+
src/server/handlers/server_monitor.yaml
152+
src/server/handlers/tests_control.yaml
153+
src/server/middlewares/configuration.yaml
154+
src/server/middlewares/headers_propagator.yaml
155+
src/server/websocket/websocket_handler.yaml
156+
src/storages/secdist/component.yaml
157+
src/storages/secdist/provider_component.yaml
158+
src/testsuite/testsuite_support.yaml
159+
src/tracing/component.yaml
160+
src/tracing/manager_component.yaml
161+
src/utils/statistics/system_statistics_collector.yaml
162+
)
163+
164+
foreach(FILE ${EMBED_FILES})
165+
string(MAKE_C_IDENTIFIER "${PROJECT_NAME}-embed_${FILE}" EMBED_TARGET_NAME)
166+
userver_embed_file(${EMBED_TARGET_NAME} FILEPATH "${FILE}" HPP_FILENAME "${FILE}")
167+
target_link_libraries(${PROJECT_NAME} PRIVATE "$<BUILD_INTERFACE:${EMBED_TARGET_NAME}>")
168+
endforeach()
169+
119170
add_subdirectory(${USERVER_THIRD_PARTY_DIRS}/llhttp llhttp)
120171

121172
add_subdirectory(${USERVER_THIRD_PARTY_DIRS}/http-parser http-parser)

core/src/baggage/baggage_manager.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#include <userver/utils/assert.hpp>
1010
#include <userver/yaml_config/merge_schemas.hpp>
1111

12+
#ifndef ARCADIA_ROOT
13+
#include "generated/src/baggage/baggage_manager.yaml.hpp" // Y_IGNORE
14+
#endif
15+
1216
USERVER_NAMESPACE_BEGIN
1317

1418
namespace baggage {
@@ -40,12 +44,7 @@ BaggageManagerComponent::BaggageManagerComponent(
4044
BaggageManager& BaggageManagerComponent::GetManager() { return baggage_manager_; }
4145

4246
yaml_config::Schema BaggageManagerComponent::GetStaticConfigSchema() {
43-
return yaml_config::MergeSchemas<ComponentBase>(R"(
44-
type: object
45-
description: Component for interaction with Baggage header.
46-
additionalProperties: false
47-
properties: {}
48-
)");
47+
return yaml_config::MergeSchemasFromResource<ComponentBase>("src/baggage/baggage_manager.yaml");
4948
}
5049

5150
BaggageManager::BaggageManager(const dynamic_config::Source& config_source)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type: object
2+
description: Component for interaction with Baggage header.
3+
additionalProperties: false
4+
properties: {}

core/src/cache/caching_component_base.cpp

Lines changed: 5 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -3,124 +3,16 @@
33
#include <userver/dump/dumper.hpp>
44
#include <userver/yaml_config/merge_schemas.hpp>
55

6+
#ifndef ARCADIA_ROOT
7+
#include "generated/src/cache/caching_component_base.yaml.hpp" // Y_IGNORE
8+
#endif
9+
610
USERVER_NAMESPACE_BEGIN
711

812
namespace components::impl {
913

1014
yaml_config::Schema GetCachingComponentBaseSchema() {
11-
return yaml_config::MergeSchemas<dump::Dumper>(R"(
12-
type: object
13-
description: Base class for caching components
14-
additionalProperties: false
15-
properties:
16-
update-types:
17-
type: string
18-
description: specifies whether incremental and/or full updates are used
19-
enum:
20-
- full-and-incremental
21-
- only-full
22-
- only-incremental
23-
update-interval:
24-
type: string
25-
description: (*required*) interval between Update invocations
26-
update-jitter:
27-
type: string
28-
description: max. amount of time by which update-interval may be adjusted for requests dispersal
29-
defaultDescription: update_interval / 10
30-
updates-enabled:
31-
type: boolean
32-
description: if false, cache updates are disabled (except for the first one if !first-update-fail-ok)
33-
defaultDescription: true
34-
full-update-interval:
35-
type: string
36-
description: interval between full updates
37-
full-update-jitter:
38-
type: string
39-
description: max. amount of time by which full-update-interval may be adjusted for requests dispersal
40-
defaultDescription: full-update-interval / 10
41-
exception-interval:
42-
type: string
43-
description: sleep interval after an unhandled exception
44-
first-update-fail-ok:
45-
type: boolean
46-
description: whether first update failure is non-fatal
47-
defaultDescription: false
48-
task-processor:
49-
type: string
50-
description: the name of the TaskProcessor for running DoWork
51-
defaultDescription: main-task-processor
52-
config-settings:
53-
type: boolean
54-
description: enables dynamic reconfiguration with CacheConfigSet
55-
defaultDescription: true
56-
additional-cleanup-interval:
57-
type: string
58-
description: how often to run background RCU garbage collector
59-
defaultDescription: 10 seconds
60-
is-strong-period:
61-
type: boolean
62-
description: whether to include Update execution time in update-interval
63-
defaultDescription: false
64-
has-pre-assign-check:
65-
type: boolean
66-
description: |
67-
enables the check before changing the value in the cache, by
68-
default it is the check that the new value is not empty
69-
defaultDescription: false
70-
testsuite-force-periodic-update:
71-
type: boolean
72-
description: |
73-
override testsuite-periodic-update-enabled in TestsuiteSupport
74-
component config
75-
failed-updates-before-expiration:
76-
type: integer
77-
description: |
78-
the number of consecutive failed updates for data expiration
79-
minimum: 0
80-
alert-on-failing-to-update-times:
81-
type: integer
82-
description: |
83-
fire an alert if the cache update failed specified amount of times
84-
in a row. If zero - alerts are disabled. Value from dynamic config
85-
takes priority over static
86-
defaultDescription: 0
87-
minimum: 0
88-
safe-data-lifetime:
89-
type: boolean
90-
description: |
91-
enables awaiting data destructors in the component's destructor.
92-
Can be set to `false` if the stored data does not refer to the component
93-
and its dependencies.
94-
defaultDescription: true
95-
dump:
96-
type: object
97-
description: Manages cache behavior after dump load
98-
additionalProperties: false
99-
properties:
100-
first-update-mode:
101-
type: string
102-
description: |
103-
Behavior of update after successful load from dump.
104-
`skip` - after successful load from dump, do nothing;
105-
`required` - make a synchronous update of type
106-
`first-update-type`, stop the service on failure;
107-
`best-effort` - make a synchronous update of type
108-
`first-update-type`, keep working and use data from dump
109-
on failure.
110-
enum:
111-
- skip
112-
- required
113-
- best-effort
114-
first-update-type:
115-
type: string
116-
description: |
117-
Update type after successful load from dump.
118-
enum:
119-
- full
120-
- incremental
121-
- incremental-then-async-full
122-
defaultDescription: full
123-
)");
15+
return yaml_config::MergeSchemasFromResource<dump::Dumper>("src/cache/caching_component_base.yaml");
12416
}
12517

12618
} // namespace components::impl
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
type: object
2+
description: Base class for caching components
3+
additionalProperties: false
4+
properties:
5+
update-types:
6+
type: string
7+
description: specifies whether incremental and/or full updates are used
8+
enum:
9+
- full-and-incremental
10+
- only-full
11+
- only-incremental
12+
update-interval:
13+
type: string
14+
description: (*required*) interval between Update invocations
15+
update-jitter:
16+
type: string
17+
description: max. amount of time by which update-interval may be adjusted
18+
for requests dispersal
19+
defaultDescription: update_interval / 10
20+
updates-enabled:
21+
type: boolean
22+
description: if false, cache updates are disabled (except for the first one
23+
if !first-update-fail-ok)
24+
defaultDescription: true
25+
full-update-interval:
26+
type: string
27+
description: interval between full updates
28+
full-update-jitter:
29+
type: string
30+
description: max. amount of time by which full-update-interval may be adjusted
31+
for requests dispersal
32+
defaultDescription: full-update-interval / 10
33+
exception-interval:
34+
type: string
35+
description: sleep interval after an unhandled exception
36+
first-update-fail-ok:
37+
type: boolean
38+
description: whether first update failure is non-fatal
39+
defaultDescription: false
40+
task-processor:
41+
type: string
42+
description: the name of the TaskProcessor for running DoWork
43+
defaultDescription: main-task-processor
44+
config-settings:
45+
type: boolean
46+
description: enables dynamic reconfiguration with CacheConfigSet
47+
defaultDescription: true
48+
additional-cleanup-interval:
49+
type: string
50+
description: how often to run background RCU garbage collector
51+
defaultDescription: 10 seconds
52+
is-strong-period:
53+
type: boolean
54+
description: whether to include Update execution time in update-interval
55+
defaultDescription: false
56+
has-pre-assign-check:
57+
type: boolean
58+
description: |
59+
enables the check before changing the value in the cache, by
60+
default it is the check that the new value is not empty
61+
defaultDescription: false
62+
testsuite-force-periodic-update:
63+
type: boolean
64+
description: |
65+
override testsuite-periodic-update-enabled in TestsuiteSupport
66+
component config
67+
failed-updates-before-expiration:
68+
type: integer
69+
description: |
70+
the number of consecutive failed updates for data expiration
71+
minimum: 0
72+
alert-on-failing-to-update-times:
73+
type: integer
74+
description: |
75+
fire an alert if the cache update failed specified amount of times
76+
in a row. If zero - alerts are disabled. Value from dynamic config
77+
takes priority over static
78+
defaultDescription: 0
79+
minimum: 0
80+
safe-data-lifetime:
81+
type: boolean
82+
description: |
83+
enables awaiting data destructors in the component's destructor.
84+
Can be set to `false` if the stored data does not refer to the component
85+
and its dependencies.
86+
defaultDescription: true
87+
dump:
88+
type: object
89+
description: Manages cache behavior after dump load
90+
additionalProperties: false
91+
properties:
92+
first-update-mode:
93+
type: string
94+
description: |
95+
Behavior of update after successful load from dump.
96+
`skip` - after successful load from dump, do nothing;
97+
`required` - make a synchronous update of type
98+
`first-update-type`, stop the service on failure;
99+
`best-effort` - make a synchronous update of type
100+
`first-update-type`, keep working and use data from dump
101+
on failure.
102+
enum:
103+
- skip
104+
- required
105+
- best-effort
106+
first-update-type:
107+
type: string
108+
description: |
109+
Update type after successful load from dump.
110+
enum:
111+
- full
112+
- incremental
113+
- incremental-then-async-full
114+
defaultDescription: full

core/src/cache/lru_cache_component_base.cpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
#include <userver/yaml_config/merge_schemas.hpp>
1010
#include <userver/yaml_config/schema.hpp>
1111

12+
#ifndef ARCADIA_ROOT
13+
#include "generated/src/cache/lru_cache_component_base.yaml.hpp" // Y_IGNORE
14+
#endif
15+
1216
USERVER_NAMESPACE_BEGIN
1317

1418
namespace cache::impl {
@@ -44,30 +48,7 @@ bool IsDumpSupportEnabled(const components::ComponentConfig& config) {
4448
}
4549

4650
yaml_config::Schema GetLruCacheComponentBaseSchema() {
47-
return yaml_config::MergeSchemas<dump::Dumper>(R"(
48-
type: object
49-
description: Base class for LRU-cache components
50-
additionalProperties: false
51-
properties:
52-
size:
53-
type: integer
54-
description: max amount of items to store in cache
55-
ways:
56-
type: integer
57-
description: number of ways for associative cache
58-
lifetime:
59-
type: string
60-
description: TTL for cache entries (0 is unlimited)
61-
defaultDescription: 0
62-
background-update:
63-
type: boolean
64-
description: enables asynchronous updates for expiring values
65-
defaultDescription: false
66-
config-settings:
67-
type: boolean
68-
description: enables dynamic reconfiguration with CacheConfigSet
69-
defaultDescription: true
70-
)");
51+
return yaml_config::MergeSchemasFromResource<dump::Dumper>("src/cache/lru_cache_component_base.yaml");
7152
}
7253

7354
} // namespace cache::impl
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
type: object
2+
description: Base class for LRU-cache components
3+
additionalProperties: false
4+
properties:
5+
size:
6+
type: integer
7+
description: max amount of items to store in cache
8+
ways:
9+
type: integer
10+
description: number of ways for associative cache
11+
lifetime:
12+
type: string
13+
description: TTL for cache entries (0 is unlimited)
14+
defaultDescription: 0
15+
background-update:
16+
type: boolean
17+
description: enables asynchronous updates for expiring values
18+
defaultDescription: false
19+
config-settings:
20+
type: boolean
21+
description: enables dynamic reconfiguration with CacheConfigSet
22+
defaultDescription: true

0 commit comments

Comments
 (0)