pub struct FileLock { /* private fields */ }Expand description
File lock manager for spec directories
Implementations§
Source§impl FileLock
impl FileLock
Sourcepub fn acquire(
spec_id: &str,
force: bool,
ttl_seconds: Option<u64>,
) -> Result<Self, LockError>
pub fn acquire( spec_id: &str, force: bool, ttl_seconds: Option<u64>, ) -> Result<Self, LockError>
Attempt to acquire an exclusive lock for the given spec ID
Uses atomic O_EXCL/create_new semantics to prevent TOCTOU race conditions. If the lock file already exists, validates the existing lock before deciding whether to override it.
§Arguments
spec_id- The spec ID to lockforce- Whether to override stale locksttl_seconds- Time-to-live for lock staleness detection (None uses default)
§Returns
Ok(FileLock)- Successfully acquired lockErr(LockError)- Failed to acquire lock (concurrent execution, stale lock, etc.)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileLock
impl RefUnwindSafe for FileLock
impl Send for FileLock
impl Sync for FileLock
impl Unpin for FileLock
impl UnsafeUnpin for FileLock
impl UnwindSafe for FileLock
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