pub struct ProcessLock { /* private fields */ }Expand description
Process lock to prevent multiple concurrent daemon startups
Implementations§
Source§impl ProcessLock
impl ProcessLock
Sourcepub fn try_acquire(&mut self) -> Result<bool>
pub fn try_acquire(&mut self) -> Result<bool>
Try to acquire the lock
Returns Ok(true) if lock was acquired (no other daemon running), Ok(false) if already held by another running process.
Important: This only checks for an existing running daemon.
Call [write_daemon_pid] after spawning the daemon to record its PID.
Sourcepub fn write_daemon_pid(&self, daemon_pid: u32) -> Result<()>
pub fn write_daemon_pid(&self, daemon_pid: u32) -> Result<()>
Write the actual daemon PID to the lock file.
Call this after spawning the Lore daemon process to replace the placeholder PID with the real daemon PID.
Sourcepub fn read_daemon_pid(&self) -> Result<Option<u32>>
pub fn read_daemon_pid(&self) -> Result<Option<u32>>
Read the daemon PID from the lock file, if present.
Trait Implementations§
Source§impl Drop for ProcessLock
impl Drop for ProcessLock
Auto Trait Implementations§
impl Freeze for ProcessLock
impl RefUnwindSafe for ProcessLock
impl Send for ProcessLock
impl Sync for ProcessLock
impl Unpin for ProcessLock
impl UnsafeUnpin for ProcessLock
impl UnwindSafe for ProcessLock
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request