28class DistLockedWorker
final {
30 using Callback = std::function<
void()>;
33 engine::TaskProcessor& task_processor,
34 std::shared_ptr<CoordinationClient> coordination_client,
35 std::string_view coordination_node,
36 std::string_view semaphore_name,
51 bool OwnsLock()
const noexcept;
53 friend void DumpMetric(
utils::statistics::Writer& writer,
const DistLockedWorker& worker);
56 void Run(
bool run_once);
58 engine::TaskProcessor& task_processor_;
59 const std::shared_ptr<CoordinationClient> coordination_client_;
60 const std::string coordination_node_;
61 const std::string semaphore_name_;
63 const Callback callback_;
65 utils::UniqueRef<impl::dist_lock::Statistics> stats_;
66 std::atomic<
bool> owns_lock_{
false};