userver: userver/dist_lock/dist_lock_settings.hpp Source File
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
8USERVER_NAMESPACE_BEGIN
9
10/// @brief Distributed locking
11namespace dist_lock {
12
13/// Distributed lock settings
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
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
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
46USERVER_NAMESPACE_END