Skip to main content

Module lock

Module lock 

Source
Expand description

Distributed lock to prevent concurrent publishes.

Re-export of crate::ops::lock (absorbed from the shipper-lock microcrate during the decrating effort — see docs/decrating-plan.md §6 Phase 2). The historical public path shipper::lock is preserved for backward compatibility. File-based locking mechanism to prevent concurrent operations.

This module provides a simple file-based lock that can be used to prevent concurrent access to shared resources across processes. The lock file contains metadata about the lock holder (PID, hostname, timestamp).

Absorbed from the standalone shipper-lock crate during the decrating effort (see docs/decrating-plan.md §6 Phase 2). The public surface at shipper::lock is preserved via a re-export in crate::lib.

§Example

use shipper_core::lock::LockFile;
use std::path::Path;

// Acquire a lock
let lock = LockFile::acquire(Path::new(".shipper"), None)?;

// Check if locked
assert!(LockFile::is_locked(Path::new(".shipper"), None)?);

// Lock is automatically released when dropped
drop(lock);

Structs§

LockFile
Lock file handle that automatically releases on Drop
LockInfo
Information stored in the lock file

Constants§

LOCK_FILE
Default lock file name

Functions§

lock_path
Get the lock file path for a state directory and optional workspace root