pub struct LeaseFile {
pub pid: u32,
pub start_time: u64,
pub last_heartbeat: u64,
}Expand description
Lease file stored at ~/.acp-cli/sessions/<key>.lease.
The queue owner writes this file on startup and updates the heartbeat periodically. Other processes read it to determine whether a live owner already exists for a given session key.
Fields§
§pid: u32PID of the queue owner process.
start_time: u64Unix timestamp (seconds) when the owner started.
last_heartbeat: u64Unix timestamp (seconds) of the last heartbeat update.
Implementations§
Source§impl LeaseFile
impl LeaseFile
Sourcepub fn write(session_key: &str) -> Result<()>
pub fn write(session_key: &str) -> Result<()>
Write a new lease file for session_key with the current PID and timestamp.
Sourcepub fn read(session_key: &str) -> Option<LeaseFile>
pub fn read(session_key: &str) -> Option<LeaseFile>
Read the lease file for session_key. Returns None if the file is
missing or cannot be parsed.
Sourcepub fn update_heartbeat(session_key: &str) -> Result<()>
pub fn update_heartbeat(session_key: &str) -> Result<()>
Update the last_heartbeat timestamp in an existing lease file.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for LeaseFile
impl<'de> Deserialize<'de> for LeaseFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LeaseFile
impl RefUnwindSafe for LeaseFile
impl Send for LeaseFile
impl Sync for LeaseFile
impl Unpin for LeaseFile
impl UnsafeUnpin for LeaseFile
impl UnwindSafe for LeaseFile
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