pub struct LockOptions {
pub timeout: Option<Duration>,
pub stale_after: Duration,
pub force: bool,
}Expand description
Tunables for lock acquisition.
Defaults come from the environment when set:
GTARS_STORE_LOCK_TIMEOUT and GTARS_STORE_LOCK_STALE_AFTER, both in
seconds. A timeout of 0 means “wait forever”.
Fields§
§timeout: Option<Duration>How long to block waiting for the lock before erroring. None = forever.
stale_after: DurationHow old a heartbeat must be before the lock is presumed stale.
force: boolBreak any existing lock immediately, without waiting. Operator escape
hatch (--force-unlock); do not set this by default.
Implementations§
Source§impl LockOptions
impl LockOptions
Sourcepub fn non_blocking() -> Self
pub fn non_blocking() -> Self
Never block: fail immediately if the lock is held by a live writer.
pub fn timeout_secs(self, secs: u64) -> Self
pub fn force(self, force: bool) -> Self
Trait Implementations§
Source§impl Clone for LockOptions
impl Clone for LockOptions
Source§impl Debug for LockOptions
impl Debug for LockOptions
Auto Trait Implementations§
impl Forget for LockOptions
impl Freeze for LockOptions
impl Move for LockOptions
impl RefUnwindSafe for LockOptions
impl Send for LockOptions
impl Sync for LockOptions
impl Unpin for LockOptions
impl UnsafeUnpin for LockOptions
impl UnwindSafe for LockOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more