pub struct Notify { /* private fields */ }Expand description
Systemd notifier.
This is only used by systemd if the service definition file has
Type=notify set, see systemd.service(5). Read sd_notify(3) for
more information about notifying the service manager about start-up
completion and other service status changes.
Implementations
sourceimpl Notify
impl Notify
sourcepub fn new<M, RT>(ctx: &mut Context<M, RT>) -> Result<Option<Notify>> where
RT: Access,
pub fn new<M, RT>(ctx: &mut Context<M, RT>) -> Result<Option<Notify>> where
RT: Access,
Create a systemd notifier using the environment variables.
This method uses the following environment variables to configure itself:
NOTIFY_SOCKET: the socket to connect to.WATCHDOG_PIDandWATCHDOG_USEC: enables the watchdog, seesystemd.service(5).
Returns None if the environment NOTIFY_SOCKET variable is not set.
sourcepub fn connect<M, RT, P>(ctx: &mut Context<M, RT>, path: P) -> Result<Notify> where
RT: Access,
P: AsRef<Path>,
pub fn connect<M, RT, P>(ctx: &mut Context<M, RT>, path: P) -> Result<Notify> where
RT: Access,
P: AsRef<Path>,
Create a systemd notifier connected to path.
sourcepub fn set_watchdog_timeout(&mut self, timeout: Option<Duration>)
pub fn set_watchdog_timeout(&mut self, timeout: Option<Duration>)
Set the watchdog timeout of Notify.
Note that this doesn’t change the timeout for the service manager.
sourcepub fn watchdog_timeout(&self) -> Option<Duration>
pub fn watchdog_timeout(&self) -> Option<Duration>
Returns the watchdog timeout, if any.
sourcepub fn change_state<'a>(
&'a self,
state: State,
status: Option<&str>
) -> ChangeState<'a>ⓘNotable traits for ChangeState<'a>impl<'a> Future for ChangeState<'a> type Output = Result<()>;
pub fn change_state<'a>(
&'a self,
state: State,
status: Option<&str>
) -> ChangeState<'a>ⓘNotable traits for ChangeState<'a>impl<'a> Future for ChangeState<'a> type Output = Result<()>;
Inform the service manager of a change in the application state.
status is a string to describe the service state. This is free-form
and can be used for various purposes: general state feedback, fsck-like
programs could pass completion percentages and failing programs could
pass a human-readable error message. Note that it must be limited to a
single line.
sourcepub fn change_status<'a>(&'a self, status: &str) -> ChangeState<'a>ⓘNotable traits for ChangeState<'a>impl<'a> Future for ChangeState<'a> type Output = Result<()>;
pub fn change_status<'a>(&'a self, status: &str) -> ChangeState<'a>ⓘNotable traits for ChangeState<'a>impl<'a> Future for ChangeState<'a> type Output = Result<()>;
Inform the service manager of a change in the application status.
status is a string to describe the service state. This is free-form
and can be used for various purposes: general state feedback, fsck-like
programs could pass completion percentages and failing programs could
pass a human-readable error message. Note that it must be limited to a
single line.
If you also need to change the state of the application you can use
Notify::change_state.
sourcepub fn ping_watchdog<'a>(&'a self) -> PingWatchdog<'a>ⓘNotable traits for PingWatchdog<'a>impl<'a> Future for PingWatchdog<'a> type Output = Result<()>;
pub fn ping_watchdog<'a>(&'a self) -> PingWatchdog<'a>ⓘNotable traits for PingWatchdog<'a>impl<'a> Future for PingWatchdog<'a> type Output = Result<()>;
Inform the service manager to update the watchdog timestamp.
Send a keep-alive ping that services need to issue in regular intervals
if WatchdogSec= is enabled for it.
sourcepub fn trigger_watchdog<'a>(&'a self) -> TriggerWatchdog<'a>ⓘNotable traits for TriggerWatchdog<'a>impl<'a> Future for TriggerWatchdog<'a> type Output = Result<()>;
pub fn trigger_watchdog<'a>(&'a self) -> TriggerWatchdog<'a>ⓘNotable traits for TriggerWatchdog<'a>impl<'a> Future for TriggerWatchdog<'a> type Output = Result<()>;
Inform the service manager that the service detected an internal error that should be handled by the configured watchdog options.
This will trigger the same behaviour as if WatchdogSec= is enabled and
the service did not call ping_watchdog in time.
Note that WatchdogSec= does not need to be enabled for this to trigger
the watchdog action. See systemd.service(5) for information about
the watchdog behavior.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Notify
impl Send for Notify
impl Sync for Notify
impl Unpin for Notify
impl UnwindSafe for Notify
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more