Skip to main content

acquire

Function acquire 

Source
pub fn acquire(
    socket_dir: &Path,
    timeout: Duration,
) -> Result<LockGuard, LockError>
Expand description

Try to acquire the apply lock at <socket_dir>/apply.lock.

timeout = Duration::ZERO makes this a non-blocking try-once. Any positive timeout re-tries with a 100 ms backoff until the lock becomes available or the budget elapses.

The lock file is created on demand. Its parent (socket_dir) must already exist — apply and friends create .socket/ separately during setup, and we don’t want lock acquisition to silently create directories on a misconfigured path.