userver
C++ Async Framework
Loading...
Searching...
No Matches
settings.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ydb/dist_lock/settings.hpp
4
/// @brief @copybrief ydb::DistLockSettings
5
6
#
include
<
chrono
>
7
8
#
include
<
userver
/
yaml_config
/
fwd
.
hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
ydb {
13
14
/// A set of tweak-able settings for ydb::DistLockWorker.
15
struct
DistLockSettings
{
16
/// @brief For how long we will try to restore session after a network failure
17
/// before dropping it. Corresponds to `TSessionSettings::Timeout`.
18
///
19
/// If the network connection to the coordination node is temporarily lost,
20
/// some normal reconnect attempts will be performed
21
/// within `session_timeout`.
22
/// After the session finally gives up, YDB Coordinator drops the active lock
23
/// held by the current host, if any.
24
std::chrono::milliseconds
session_timeout
{5000};
25
26
/// @brief Backoff before attempting to reconnect session after it returns
27
/// "permanent failure".
28
///
29
/// If the network connection to the coordination node is temporarily lost,
30
/// some normal reconnect attempts will be performed
31
/// within `session_timeout`.
32
/// After the session finally gives up, ydb::DistLockWorker will attempt
33
/// to restart the coordination session after this time.
34
std::chrono::milliseconds
restart_session_delay
{1000};
35
36
/// Backoff before repeating a failed Acquire call.
37
std::chrono::milliseconds
acquire_interval
{100};
38
39
/// Backoff before calling DoWork again after it returns or throws.
40
std::chrono::milliseconds
restart_delay
{100};
41
42
/// @brief Time, within which a cancelled `DoWork` is expected to finish.
43
///
44
/// Ignoring cancellations for this long can lead to a "brain split" where
45
/// `DoWork` is running on multiple hosts. Practically speaking, this time
46
/// can be computed as:
47
///
48
/// `TNodeSettings::SessionGracePeriod - TSessionSettings::Timeout`
49
///
50
/// and should be set to that or a smaller value.
51
std::chrono::milliseconds
cancel_task_time_limit
{5000};
52
};
53
54
}
// namespace ydb
55
56
namespace
formats::
parse
{
57
58
// ydb::Parse is a variable template, thus have to define formats Parse here.
59
ydb::
DistLockSettings
Parse(
const
yaml_config
::
YamlConfig
& config,
To
<ydb::
DistLockSettings
>);
60
61
}
// namespace formats::parse
62
63
USERVER_NAMESPACE_END
userver
ydb
dist_lock
settings.hpp
Generated on Tue Nov 19 2024 11:28:33 for userver by
Doxygen
1.10.0