userver: userver/storages/mongo/dist_lock_strategy.hpp Source File
Loading...
Searching...
No Matches
dist_lock_strategy.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <chrono>
7#include <string>
8
11
12USERVER_NAMESPACE_BEGIN
13
14namespace storages::mongo {
15
18public:
20 DistLockStrategy(Collection collection, std::string lock_name);
21
22 DistLockStrategy(Collection collection, std::string lock_name, std::string owner);
23
24 void Acquire(std::chrono::milliseconds lock_ttl, const std::string& locker_id) override;
25
26 void Prolong(std::chrono::milliseconds lock_ttl, const std::string& locker_id) override;
27
28 void Release(const std::string& locker_id) override;
29
30private:
32 std::string lock_name_;
33 std::string owner_prefix_;
34};
35
36} // namespace storages::mongo
37
38USERVER_NAMESPACE_END