Skip to main content

InstallRecord

Struct InstallRecord 

Source
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: u32

RECORD_SCHEMA_VERSION at the time of writing.

§service_name: String

What the operating system calls the registration.

§manager: String

Which service manager holds it.

§start_mode: StartMode

Boot or login.

§account: ServiceAccount

The account it runs under.

§binary: PathBuf

The 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: u64

The restart-on-failure delay.

§restart_reset_secs: u64

How long it must run before the failure count resets.

§log_file: PathBuf

The rotating diagnostic log’s stem. Item 4.

§starts_on_demand: bool

Whether 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: String

Which build of the product made it.

§directories: ServiceDirectories

The four directories the registration was installed against. Item 2’s “configured cache and runtime directories”.

Implementations§

Source§

impl InstallRecord

Source

pub fn path(paths: &AppPaths) -> PathBuf

Where the record lives, given this host’s directories.

Source

pub fn of( plan: &InstallPlan, definition: &ServiceDefinition, at: DateTime<Utc>, ) -> Self

Builds the record for a plan that has just been applied.

Source

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.

Source

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.

Source

pub fn write(&self, paths: &AppPaths) -> Result<(), ServiceError>

Writes the record, replacing whatever was there.

§Errors

ServiceError::Record.

Source

pub fn remove(paths: &AppPaths) -> Result<bool, ServiceError>

Removes the record. Returns whether there was one.

§Errors

ServiceError::Record.

Trait Implementations§

Source§

impl Clone for InstallRecord

Source§

fn clone(&self) -> InstallRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InstallRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for InstallRecord

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for InstallRecord

Source§

impl PartialEq for InstallRecord

Source§

fn eq(&self, other: &InstallRecord) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for InstallRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for InstallRecord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more