userver: dist_lock::DistLockSettings Struct Reference
Loading...
Searching...
No Matches
dist_lock::DistLockSettings Struct Reference

#include <userver/dist_lock/dist_lock_settings.hpp>

Detailed Description

Distributed lock settings.

Definition at line 28 of file dist_lock_settings.hpp.

Public Member Functions

bool operator== (const DistLockSettings &) const =default
 Compare all timing, enablement and fallback settings.

Public Attributes

std::chrono::milliseconds acquire_interval {100}
 How often to try to acquire the lock.
std::chrono::milliseconds prolong_interval {100}
 How often to try to prolong the lock while holding the lock.
std::chrono::milliseconds lock_ttl {1000}
 For how long to acquire/prolong the lock.
std::chrono::milliseconds forced_stop_margin {50}
std::chrono::milliseconds worker_func_restart_delay {100}
 Delay before DoWork is restarted after exiting with or without an exception.
bool is_enabled {true}
std::optional< DistLockFallbackSettings > fallback_policy {}
 Shared fallback policy, including on preferred hosts that record release history.
bool is_host_deprioritized {false}

Member Data Documentation

◆ acquire_interval

std::chrono::milliseconds dist_lock::DistLockSettings::acquire_interval {100}

How often to try to acquire the lock.

Definition at line 30 of file dist_lock_settings.hpp.

◆ fallback_policy

std::optional<DistLockFallbackSettings> dist_lock::DistLockSettings::fallback_policy {}

Shared fallback policy, including on preferred hosts that record release history.

Definition at line 52 of file dist_lock_settings.hpp.

◆ forced_stop_margin

std::chrono::milliseconds dist_lock::DistLockSettings::forced_stop_margin {50}

How much time we allow for the worker to stop when we're unable to prolong the lock.

Definition at line 40 of file dist_lock_settings.hpp.

◆ is_enabled

bool dist_lock::DistLockSettings::is_enabled {true}

Defaults to true and is updated from dynamic config. When switched to false, dist_lock::DistLockedWorker will not start any new distributed lock acquisition attempts. If a DoWork invocation is already running under the lock, it is allowed to finish without forced cancellation. In this case dist_lock::DistLockedWorker::IsCancelAdvised returns true.

Definition at line 49 of file dist_lock_settings.hpp.

◆ is_host_deprioritized

bool dist_lock::DistLockSettings::is_host_deprioritized {false}

If true, this host waits for fallback checks before acquiring the lock. After fallback succeeds, the host can acquire the lock normally until the fallback grant expires. If false, this host can acquire the lock immediately when the lock is available.

Definition at line 57 of file dist_lock_settings.hpp.

◆ lock_ttl

std::chrono::milliseconds dist_lock::DistLockSettings::lock_ttl {1000}

For how long to acquire/prolong the lock.

Definition at line 36 of file dist_lock_settings.hpp.

◆ prolong_interval

std::chrono::milliseconds dist_lock::DistLockSettings::prolong_interval {100}

How often to try to prolong the lock while holding the lock.

Definition at line 33 of file dist_lock_settings.hpp.

◆ worker_func_restart_delay

std::chrono::milliseconds dist_lock::DistLockSettings::worker_func_restart_delay {100}

Delay before DoWork is restarted after exiting with or without an exception.

Definition at line 43 of file dist_lock_settings.hpp.


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