userver
C++ Async Framework
Loading...
Searching...
No Matches
dist_lock_settings.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/dist_lock/dist_lock_settings.hpp
4
/// @brief @copybrief dist_lock::DistLockSettings
5
6
#
include
<
chrono
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
/// @brief Distributed locking
11
namespace
dist_lock
{
12
13
/// Distributed lock settings
14
struct
DistLockSettings
{
15
/// How often to try to acquire the lock.
16
std::chrono::milliseconds
acquire_interval
{100};
17
18
/// How often to try to prolong the lock while holding the lock.
19
std::chrono::milliseconds
prolong_interval
{100};
20
21
/// For how long to acquire/prolong the lock.
22
std::chrono::milliseconds
lock_ttl
{1000};
23
24
/// How much time we allow for the worker to stop when we're unable to prolong
25
/// the lock.
26
std::chrono::milliseconds
forced_stop_margin
{50};
27
28
/// Delay before failed worker_func restart
29
std::chrono::milliseconds
worker_func_restart_delay
{100};
30
};
31
32
/// Distributed lock waiting mode
33
enum
class
DistLockWaitingMode
{
34
kWait
,
///< waits until distlock becomes free
35
kNoWait
,
///< doesn't wait for distlock if it is occupied
36
};
37
38
/// Distributed lock retry strategy
39
enum
class
DistLockRetryMode
{
40
kRetry
,
///< Retry on user exception/lock drop
41
kSingleAttempt
,
///< Don't retry on user exception/lock drop
42
};
43
44
}
// namespace dist_lock
45
46
USERVER_NAMESPACE_END
userver
dist_lock
dist_lock_settings.hpp
Generated on Tue Nov 19 2024 11:27:41 for userver by
Doxygen
1.10.0