#include <userver/ydb/dist_lock/worker.hpp>
A high-level primitive that perpetually tries to acquire a distributed lock and runs user callback in a separate task while the lock is held. Cancels the task when the lock is lost.
Definition at line 28 of file worker.hpp.
Public Types | |
using | Callback = std::function<void()> |
Public Member Functions | |
DistLockedWorker (engine::TaskProcessor &task_processor, std::shared_ptr< CoordinationClient > coordination_client, std::string_view coordination_node, std::string_view semaphore_name, DistLockSettings settings, Callback callback) | |
void | Start () |
void | Stop () noexcept |
void | RunOnce () |
Run the callback once under distlock, useful in tests. | |
bool | OwnsLock () const noexcept |
using ydb::DistLockedWorker::Callback = std::function<void()> |
Definition at line 30 of file worker.hpp.
void ydb::DistLockedWorker::RunOnce | ( | ) |
Run the callback once under distlock, useful in tests.