userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
dist_lock_component_base.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <
userver/components/component_base.hpp
>
7
#include <
userver/dist_lock/dist_locked_worker.hpp
>
8
#include <
userver/storages/mongo/collection.hpp
>
9
#include <
userver/storages/mongo/dist_lock_strategy.hpp
>
10
11
USERVER_NAMESPACE_BEGIN
12
13
namespace
storages::mongo
{
14
50
class
DistLockComponentBase :
public
components::ComponentBase
{
51
public
:
52
DistLockComponentBase(
53
const
components::ComponentConfig
&,
54
const
components::ComponentContext
&,
55
storages::mongo::Collection
56
);
57
58
dist_lock::DistLockedWorker
& GetWorker();
59
61
bool
OwnsLock
() const noexcept;
62
63
static
yaml_config
::Schema GetStaticConfigSchema();
64
65
protected:
96
virtual
void
DoWork
() = 0;
97
99
virtual
void
DoWorkTestsuite
() {
DoWork
(); }
100
103
void
Start
();
104
106
void
Stop
();
107
108
private
:
109
const
bool
autostart_;
110
std::unique_ptr<dist_lock::DistLockedWorker> worker_;
111
bool
testsuite_enabled_{
false
};
112
};
113
114
}
// namespace storages::mongo
115
116
USERVER_NAMESPACE_END
userver
storages
mongo
dist_lock_component_base.hpp
Generated on
for userver by
Doxygen
1.17.0