userver: userver/storages/mongo/dist_lock_component_base.hpp Source File
Loading...
Searching...
No Matches
dist_lock_component_base.hpp
Go to the documentation of this file.
1#pragma once
2
5
10
11USERVER_NAMESPACE_BEGIN
12
13namespace storages::mongo {
14
50class DistLockComponentBase : public components::ComponentBase {
51public:
52 DistLockComponentBase(
56 );
57
58 dist_lock::DistLockedWorker& GetWorker();
59
61 bool OwnsLock() const noexcept;
62
63 static yaml_config::Schema GetStaticConfigSchema();
64
65protected:
96 virtual void DoWork() = 0;
97
99 virtual void DoWorkTestsuite() { DoWork(); }
100
103 void Start();
104
106 void Stop();
107
108private:
109 const bool autostart_;
110 std::unique_ptr<dist_lock::DistLockedWorker> worker_;
111 bool testsuite_enabled_{false};
112};
113
114} // namespace storages::mongo
115
116USERVER_NAMESPACE_END