userver: storages::postgres::DistLockStrategy Class Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
storages::postgres::DistLockStrategy Class Referencefinal

Postgres distributed locking strategy. More...

#include <userver/storages/postgres/dist_lock_strategy.hpp>

+ Inheritance diagram for storages::postgres::DistLockStrategy:
+ Collaboration diagram for storages::postgres::DistLockStrategy:

Public Member Functions

 DistLockStrategy (ClusterPtr cluster, const std::string &table, const std::string &lock_name, const dist_lock::DistLockSettings &settings)
 
void Acquire (std::chrono::milliseconds lock_ttl, const std::string &locker_id) override
 
void Release (const std::string &locker_id) override
 
void UpdateCommandControl (CommandControl cc)
 

Detailed Description

Postgres distributed locking strategy.

Definition at line 17 of file dist_lock_strategy.hpp.

Member Function Documentation

◆ Acquire()

void storages::postgres::DistLockStrategy::Acquire ( std::chrono::milliseconds  lock_ttl,
const std::string &  locker_id 
)
overridevirtual

Acquires the distributed lock.

Parameters
lock_ttlThe duration for which the lock must be held.
locker_idGlobally unique ID of the locking entity.
Exceptions
LockIsAcquiredByAnotherHostErrorwhen the lock is busy
anythingelse when the locking fails, strategy is responsible for cleanup, Release won't be invoked.

Implements dist_lock::DistLockStrategyBase.

◆ Release()

void storages::postgres::DistLockStrategy::Release ( const std::string &  locker_id)
overridevirtual

Releases the lock.

Parameters
locker_idGlobally unique ID of the locking entity, must be the same as in Acquire().
Note
Exceptions are ignored.

Implements dist_lock::DistLockStrategyBase.


The documentation for this class was generated from the following file: