userver
C++ Async Framework (beta)
Loading...
Searching...
No Matches
userver
storages
mongo
dist_lock_component_base.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <
userver/components/loggable_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
#include <
userver/utils/statistics/entry.hpp
>
11
12
USERVER_NAMESPACE_BEGIN
13
14
namespace
storages::mongo
{
15
16
// clang-format off
17
56
57
// clang-format on
58
59
class
DistLockComponentBase
:
public
components::LoggableComponentBase
{
60
public
:
61
DistLockComponentBase
(
const
components::ComponentConfig
&,
62
const
components::ComponentContext
&,
63
storages::mongo::Collection
);
64
65
~DistLockComponentBase
()
override
;
66
67
dist_lock::DistLockedWorker
& GetWorker();
68
69
static
yaml_config::Schema
GetStaticConfigSchema();
70
71
protected
:
99
virtual
void
DoWork
() = 0;
100
102
virtual
void
DoWorkTestsuite
() {
DoWork
(); }
103
105
void
Start
();
106
108
void
Stop
();
109
110
private
:
111
std::unique_ptr<dist_lock::DistLockedWorker> worker_;
112
utils::statistics::Entry
statistics_holder_;
113
bool
testsuite_enabled_{
false
};
114
};
115
116
}
// namespace storages::mongo
117
118
USERVER_NAMESPACE_END
Generated on Tue Mar 14 2023 16:21:24 for userver by
Doxygen
1.9.6