|
3 | 3 | #include <userver/dump/dumper.hpp> |
4 | 4 | #include <userver/yaml_config/merge_schemas.hpp> |
5 | 5 |
|
| 6 | +#ifndef ARCADIA_ROOT |
| 7 | +#include "generated/src/cache/caching_component_base.yaml.hpp" // Y_IGNORE |
| 8 | +#endif |
| 9 | + |
6 | 10 | USERVER_NAMESPACE_BEGIN |
7 | 11 |
|
8 | 12 | namespace components::impl { |
9 | 13 |
|
10 | 14 | 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"); |
124 | 16 | } |
125 | 17 |
|
126 | 18 | } // namespace components::impl |
|
0 commit comments