Skip to content

Commit f25ba49

Browse files
committed
feat docs: use schemas in YDB dist-locks
Tests: протестировано в CI, проверено локально что все поля отображаются и форматируются приятно для глаза (или хотя бы как было раньше) commit_hash:00fdd6d0ece33b870db1ef8750c6386a8eeb0a99
1 parent e23e02a commit f25ba49

File tree

1 file changed

+5
-60
lines changed

1 file changed

+5
-60
lines changed

ydb/src/ydb/dist_lock/component_base.cpp

Lines changed: 5 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
#include <ydb/impl/dist_lock/semaphore_settings.hpp>
1313

14+
#ifndef ARCADIA_ROOT
15+
#include "generated/src/ydb/dist_lock/component_base.yaml.hpp" // Y_IGNORE
16+
#endif
17+
1418
USERVER_NAMESPACE_BEGIN
1519

1620
namespace ydb {
@@ -136,66 +140,7 @@ void DistLockComponentBase::Start() {
136140
void DistLockComponentBase::Stop() noexcept { worker_->Stop(); }
137141

138142
yaml_config::Schema DistLockComponentBase::GetStaticConfigSchema() {
139-
return yaml_config::MergeSchemas<components::ComponentBase>(R"(
140-
type: object
141-
description: YDB distlock component
142-
additionalProperties: false
143-
properties:
144-
semaphore-name:
145-
type: string
146-
description: name of the semaphore within the coordination node
147-
database-settings:
148-
type: object
149-
description: settings that might be used for a group of related distlock instances
150-
additionalProperties: false
151-
properties:
152-
dbname:
153-
type: string
154-
description: the key of the database within ydb component (NOT the actual database path)
155-
coordination-node:
156-
type: string
157-
description: name of the coordination node within the database
158-
initial-setup:
159-
type: boolean
160-
description: if true, then create the coordination node and the semaphore unless they already exist
161-
defaultDescription: true
162-
task-processor:
163-
type: string
164-
description: the name of the TaskProcessor for running DoWork
165-
defaultDescription: the default TaskProcessor, typically main-task-processor
166-
node-settings:
167-
type: object
168-
description: settings for coordination node creation
169-
additionalProperties: false
170-
properties:
171-
session-grace-period:
172-
type: string
173-
description: |
174-
the time after which the lock will be given to another host
175-
after a network failure; this timer starts
176-
on the coordination node conceptually at the same time
177-
as 'session-timeout' timer starts on the service instance
178-
session-timeout:
179-
type: string
180-
description: for how long we will try to restore session after a network failure before dropping it
181-
defaultDescription: 5s
182-
restart-session-delay:
183-
type: string
184-
description: backoff before attempting to reconnect session after it returns "permanent failure"
185-
defaultDescription: 1s
186-
acquire-interval:
187-
type: string
188-
description: backoff before repeating a failed Acquire call
189-
defaultDescription: 100ms
190-
restart-delay:
191-
type: string
192-
description: backoff before calling DoWork again after it returns or throws
193-
defaultDescription: 100ms
194-
cancel-task-time-limit:
195-
type: string
196-
description: time, within which a cancelled DoWork is expected to finish
197-
defaultDescription: 5s
198-
)");
143+
return yaml_config::MergeSchemasFromResource<components::ComponentBase>("src/ydb/dist_lock/component_base.yaml");
199144
}
200145

201146
} // namespace ydb

0 commit comments

Comments
 (0)