Interface for distributed lock strategies. More...
#include <userver/dist_lock/dist_lock_strategy.hpp>
Public Member Functions | |
virtual void | Acquire (std::chrono::milliseconds lock_ttl, const std::string &locker_id)=0 |
virtual void | Release (const std::string &locker_id)=0 |
Interface for distributed lock strategies.
Definition at line 24 of file dist_lock_strategy.hpp.
|
pure virtual |
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. |
Implemented in storages::mongo::DistLockStrategy, and storages::postgres::DistLockStrategy.
|
pure virtual |
Releases the lock.
locker_id | Globally unique ID of the locking entity, must be the same as in Acquire(). |
Implemented in storages::mongo::DistLockStrategy, and storages::postgres::DistLockStrategy.