userver
C++ Async Framework
Loading...
Searching...
No Matches
dist_lock_strategy.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/storages/postgres/dist_lock_strategy.hpp
4
/// @brief @copybrief storages::postgres::DistLockStrategy
5
6
#
include
<
userver
/
dist_lock
/
dist_lock_settings
.
hpp
>
7
#
include
<
userver
/
dist_lock
/
dist_lock_strategy
.
hpp
>
8
#
include
<
userver
/
engine
/
deadline
.
hpp
>
9
#
include
<
userver
/
rcu
/
rcu
.
hpp
>
10
#
include
<
userver
/
storages
/
postgres
/
options
.
hpp
>
11
#
include
<
userver
/
storages
/
postgres
/
query
.
hpp
>
12
13
USERVER_NAMESPACE_BEGIN
14
15
namespace
storages::
postgres
{
16
17
/// Postgres distributed locking strategy
18
class
DistLockStrategy
final
:
public
dist_lock
::
DistLockStrategyBase
{
19
public
:
20
DistLockStrategy(
21
ClusterPtr cluster,
22
const
std::string& table,
23
const
std::string& lock_name,
24
const
dist_lock
::
DistLockSettings
& settings
25
);
26
27
void
Acquire
(std::chrono::milliseconds lock_ttl,
const
std::string& locker_id)
override
;
28
29
void
Release
(
const
std::string& locker_id)
override
;
30
31
void
UpdateCommandControl(
CommandControl
cc);
32
33
private
:
34
ClusterPtr cluster_;
35
rcu
::Variable<
CommandControl
> cc_;
36
const
Query acquire_query_;
37
const
Query release_query_;
38
const
std::string lock_name_;
39
const
std::string owner_prefix_;
40
};
41
42
}
// namespace storages::postgres
43
44
USERVER_NAMESPACE_END
userver
storages
postgres
dist_lock_strategy.hpp
Generated on Thu Apr 16 2026 13:32:36 for userver by
Doxygen
1.13.2