pub struct InstallRecord {Show 16 fields
pub schema_version: u32,
pub service_name: String,
pub manager: String,
pub start_mode: StartMode,
pub account: ServiceAccount,
pub binary: PathBuf,
pub source_binary: Option<PathBuf>,
pub arguments: Vec<String>,
pub restart_delay_secs: u64,
pub restart_reset_secs: u64,
pub log_file: PathBuf,
pub starts_on_demand: bool,
pub definition_path: Option<PathBuf>,
pub installed_at: DateTime<Utc>,
pub installed_by_version: String,
pub directories: ServiceDirectories,
}Expand description
What service install wrote down, and what service status reads back.
This is the record half of 05-infrastructure.md item 6. The service
manager also knows the binary path, and the two are compared: a registration
whose command line no longer matches the record is a registration something
else has edited, and saying so is more useful than picking one of them to
believe.
It holds no credential. The nearest thing is the location of the secret
store, which d2 publishes for host show to print, and even that is
derived rather than stored.
Fields§
§schema_version: u32RECORD_SCHEMA_VERSION at the time of writing.
service_name: StringWhat the operating system calls the registration.
manager: StringWhich service manager holds it.
start_mode: StartModeBoot or login.
account: ServiceAccountThe account it runs under.
binary: PathBufThe resolved absolute path of the binary at install time. Item 6.
source_binary: Option<PathBuf>Where Self::binary was copied from, when it is a copy.
#[serde(default)] rather than a schema bump: a record written before
this existed is still readable, and reads as None. That is not a
silent downgrade — None means the registration names a package
manager’s own file, which is the layout that cannot be upgraded while
the service runs, and service status says so by name.
arguments: Vec<String>The arguments it was registered with.
restart_delay_secs: u64The restart-on-failure delay.
restart_reset_secs: u64How long it must run before the failure count resets.
log_file: PathBufThe rotating diagnostic log’s stem. Item 4.
starts_on_demand: boolWhether the manager was asked not to start this by itself. Always
false for a registration an operator made; see
InstallRequest::started_on_demand.
#[serde(default)] so that a record missing the field is rejected by
the schema check below, with its remedy, rather than by a parse error
that names a field an operator has never heard of.
definition_path: Option<PathBuf>Where the platform’s definition file was written, when there is one.
installed_at: DateTime<Utc>When the registration was made.
installed_by_version: StringWhich build of the product made it.
directories: ServiceDirectoriesThe four directories the registration was installed against. Item 2’s “configured cache and runtime directories”.
Implementations§
Source§impl InstallRecord
impl InstallRecord
Sourcepub fn path(paths: &AppPaths) -> PathBuf
pub fn path(paths: &AppPaths) -> PathBuf
Where the record lives, given this host’s directories.
Sourcepub fn of(
plan: &InstallPlan,
definition: &ServiceDefinition,
at: DateTime<Utc>,
) -> Self
pub fn of( plan: &InstallPlan, definition: &ServiceDefinition, at: DateTime<Utc>, ) -> Self
Builds the record for a plan that has just been applied.
Sourcepub fn restart(&self) -> RestartPolicy
pub fn restart(&self) -> RestartPolicy
The restart policy this record describes, or RestartPolicy::default
when the recorded numbers are outside the supported range — which can
only happen to a record something else has edited.
Sourcepub fn read(paths: &AppPaths) -> Result<Option<Self>, ServiceError>
pub fn read(paths: &AppPaths) -> Result<Option<Self>, ServiceError>
Reads the record, or reports that there is none.
Ok(None) means no registration was made by this product on this host.
§Errors
ServiceError::Record when the file exists and cannot be read,
ServiceError::RecordNotPermitted when it exists and this account may
not read it, and ServiceError::RecordUnreadable when it is not a
record this version understands.
Trait Implementations§
Source§impl Clone for InstallRecord
impl Clone for InstallRecord
Source§fn clone(&self) -> InstallRecord
fn clone(&self) -> InstallRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more