Your opinion will help to improve our service
Leave a feedback >#include <userver/storages/mongo/dist_lock_strategy.hpp>
Strategy for mongodb-based distributed locking.
Definition at line 14 of file dist_lock_strategy.hpp.
Public Member Functions | |
DistLockStrategy (Collection collection, std::string lock_name) | |
Targets a distributed lock in a specified collection as a host. | |
DistLockStrategy (Collection collection, std::string lock_name, std::string owner) | |
void | Acquire (std::chrono::milliseconds lock_ttl, const std::string &locker_id) override |
void | Release (const std::string &locker_id) override |
|
overridevirtual |
Acquires the distributed lock.
lock_ttl | The duration for which the lock must be held. |
locker_id | Globally unique ID of the locking entity. |
LockIsAcquiredByAnotherHostError | when the lock is busy |
anything | else when the locking fails, strategy is responsible for cleanup, Release won't be invoked. |
Implements dist_lock::DistLockStrategyBase.
|
overridevirtual |
Releases the lock.
locker_id | Globally unique ID of the locking entity, must be the same as in Acquire(). |
Implements dist_lock::DistLockStrategyBase.