userver: dist_lock Namespace Reference
Loading...
Searching...
No Matches
dist_lock Namespace Reference

Detailed Description

Distributed locking.

Classes

class  DistLockedTask
 A task that tries to acquire a distributed lock and runs user callback once while the lock is held. More...
class  DistLockedWorker
 Perpetually acquires a distributed lock and runs a callback while it is held and runs user callback in a separate task while the lock is held. Cancels the task when the lock is lost. More...
struct  DistLockFallbackSettings
 Fallback policy shared by all lock participants, including release history. More...
struct  DistLockSettings
 Distributed lock settings. More...
class  DistLockStrategyBase
 Interface for distributed lock strategies. More...
class  LockIsAcquiredByAnotherHostException
 Indicates that lock cannot be acquired because it's busy. More...
struct  LockOperationOptions
 Parameters for dist_lock::DistLockStrategyBase::ExecuteOperation. More...
struct  ReleaseOptions
 Parameters for dist_lock::DistLockStrategyBase::Release. More...
struct  Statistics
 Distributed lock worker statistics counters. More...

Enumerations

enum class  DistLockWaitingMode {
  kWait ,
  kNoWait
}
 Distributed lock waiting mode. More...
enum class  DistLockRetryMode {
  kRetry ,
  kSingleAttempt
}
 Distributed lock retry strategy. More...
enum class  LockOperation {
  kAcquire ,
  kProlong ,
  kCheck ,
  kFallback
}
 Operation performed by dist_lock::DistLockStrategyBase::ExecuteOperation. More...
enum class  LockOperationResult {
  kAcquired ,
  kBusy ,
  kNotAlive ,
  kUnsupported
}
 Expected outcome of a distributed lock operation. Backend failures still throw. More...

Functions

void DumpMetric (utils::statistics::Writer &writer, const DistLockedWorker &worker)

Enumeration Type Documentation

◆ DistLockRetryMode

enum class dist_lock::DistLockRetryMode
strong

Distributed lock retry strategy.

Enumerator
kRetry 

Retry on user exception/lock drop.

kSingleAttempt 

Don't retry on user exception/lock drop.

Definition at line 70 of file dist_lock_settings.hpp.

◆ DistLockWaitingMode

enum class dist_lock::DistLockWaitingMode
strong

Distributed lock waiting mode.

Enumerator
kWait 

waits until distlock becomes free

kNoWait 

doesn't wait for distlock if it is occupied

Definition at line 64 of file dist_lock_settings.hpp.

◆ LockOperation

enum class dist_lock::LockOperation
strong

Operation performed by dist_lock::DistLockStrategyBase::ExecuteOperation.

Enumerator
kAcquire 

Acquire an available lock.

kProlong 

Refresh a lock already owned by this locker.

kCheck 

Check for a live lock without acquiring or refreshing it.

kFallback 

Acquire only after a shared interval without lock activity.

Definition at line 18 of file dist_lock_strategy.hpp.

◆ LockOperationResult

enum class dist_lock::LockOperationResult
strong

Expected outcome of a distributed lock operation. Backend failures still throw.

Enumerator
kAcquired 

The lock was acquired or refreshed.

kBusy 

The lock is busy or the required idle interval has not elapsed.

kNotAlive 

A successful check found no live lock.

kUnsupported 

The strategy does not support this operation.

Definition at line 26 of file dist_lock_strategy.hpp.