pub struct ServiceIdentity { /* private fields */ }Expand description
What the operating system calls this registration.
A type rather than three constants, for one reason that is not tidiness: the
privileged installer tests register a real service on a real machine,
and they must not be able to collide with — or remove — an operator’s
installation. ServiceIdentity::fixture produces a name that is
unmistakably a test artefact, and every backend takes its name from here, so
there is no path by which a test reaches the product’s own registration.
Implementations§
Source§impl ServiceIdentity
impl ServiceIdentity
Sourcepub fn fixture(tag: &str) -> Self
pub fn fixture(tag: &str) -> Self
A disposable registration for a privileged test, named so that it cannot
be mistaken for — or collide with — ServiceIdentity::product.
tag distinguishes concurrent runs; it is reduced to ASCII alphanumerics
and - so that it is a legal service name, launchd label, systemd unit
name, and Task Scheduler task name at once.
Sourcepub fn is_fixture(&self) -> bool
pub fn is_fixture(&self) -> bool
Whether this identity is a disposable test fixture.
The privileged tests assert this before they delete anything, which is the mechanical half of “never touch a service you did not create”.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
The Windows service name, the systemd unit stem, and the Task Scheduler task name.
Sourcepub fn display_name(&self) -> &str
pub fn display_name(&self) -> &str
The human-readable name.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
One line of explanation.
Sourcepub fn launchd_label(&self) -> String
pub fn launchd_label(&self) -> String
The launchd label — reverse-domain, as launchd expects.
Built from the same three product segments crate::paths resolves the
application-data directories with, so a label and a directory cannot
drift apart.
Sourcepub fn systemd_unit(&self) -> String
pub fn systemd_unit(&self) -> String
The systemd unit file name.
Sourcepub fn restart_command(&self, mode: StartMode) -> String
pub fn restart_command(&self, mode: StartMode) -> String
The service manager’s own command that restarts this registration.
The product has no service stop or service start, and
service install is no restart either: it refuses while the running
daemon holds the agent lock. So a remedy that restarts the daemon names
the service manager’s command. A forced restart does not wait for jobs;
it is for a daemon that has stopped making progress anyway.