userver
C++ Async Framework
Toggle main menu visibility
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
<
string_view
>
7
8
#
include
<
userver
/
dist_lock
/
dist_lock_settings
.
hpp
>
9
#
include
<
userver
/
dist_lock
/
dist_lock_strategy
.
hpp
>
10
#
include
<
userver
/
engine
/
deadline
.
hpp
>
11
#
include
<
userver
/
rcu
/
rcu
.
hpp
>
12
#
include
<
userver
/
storages
/
postgres
/
options
.
hpp
>
13
#
include
<
userver
/
storages
/
postgres
/
query
.
hpp
>
14
15
USERVER_NAMESPACE_BEGIN
16
17
namespace
storages::
postgres
{
18
19
/// Postgres distributed locking strategy
20
class
DistLockStrategy
final
:
public
dist_lock
::
DistLockStrategyBase
{
21
public
:
22
DistLockStrategy(
23
ClusterPtr
cluster,
24
std::string_view table,
25
std::string_view lock_name,
26
const
dist_lock
::
DistLockSettings
& settings
27
);
28
29
void
Acquire
(std::chrono::milliseconds lock_ttl,
const
std::string& locker_id)
override
;
30
31
void
Release
(
const
std::string& locker_id)
override
;
32
33
void
UpdateCommandControl(
CommandControl
cc);
34
35
private
:
36
ClusterPtr
cluster_;
37
rcu
::
Variable
<
CommandControl
> cc_;
38
const
Query acquire_query_;
39
const
Query release_query_;
40
const
std::string lock_name_;
41
const
std::string owner_prefix_;
42
};
43
44
}
// namespace storages::postgres
45
46
USERVER_NAMESPACE_END
userver
storages
postgres
dist_lock_strategy.hpp
Generated on
for userver by
Doxygen
1.17.0