pub struct DaemonManager { /* private fields */ }Expand description
Daemon lifecycle manager
Implementations§
Source§impl DaemonManager
impl DaemonManager
Sourcepub async fn AcquireLock(&self) -> Result<()>
pub async fn AcquireLock(&self) -> Result<()>
Acquire daemon lock to ensure single instance This method provides comprehensive defensive coding with:
- Race condition protection through mutex locking
- PID file checksum verification
- Process validation checks
- Atomic operations with rollback on failure
- Timeout handling
Sourcepub async fn IsAlreadyRunning(&self) -> Result<bool>
pub async fn IsAlreadyRunning(&self) -> Result<bool>
Check if daemon is already running Performs comprehensive validation including:
- PID file existence check
- Checksum verification
- Process existence validation
- Stale PID file cleanup
Sourcepub async fn ReleaseLock(&self) -> Result<()>
pub async fn ReleaseLock(&self) -> Result<()>
Release daemon lock with proper cleanup and rollback Ensures all resources are properly cleaned up even on failure
Sourcepub async fn RequestShutdown(&self) -> Result<()>
pub async fn RequestShutdown(&self) -> Result<()>
Request graceful shutdown
Sourcepub async fn ClearShutdownRequest(&self) -> Result<()>
pub async fn ClearShutdownRequest(&self) -> Result<()>
Clear shutdown request (for restart scenarios)
Sourcepub async fn IsShutdownRequested(&self) -> bool
pub async fn IsShutdownRequested(&self) -> bool
Check if shutdown has been requested
Sourcepub async fn GetStatus(&self) -> Result<DaemonStatus>
pub async fn GetStatus(&self) -> Result<DaemonStatus>
Get daemon status with comprehensive health information
Sourcepub fn GenerateServiceFile(&self) -> Result<String>
pub fn GenerateServiceFile(&self) -> Result<String>
Generate system service file for installation
Sourcepub async fn InstallService(&self) -> Result<()>
pub async fn InstallService(&self) -> Result<()>
Install daemon as system service with validation
Sourcepub async fn UninstallService(&self) -> Result<()>
pub async fn UninstallService(&self) -> Result<()>
Uninstall system service with proper coordination
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DaemonManager
impl !RefUnwindSafe for DaemonManager
impl Send for DaemonManager
impl Sync for DaemonManager
impl Unpin for DaemonManager
impl !UnwindSafe for DaemonManager
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].