Skip to main content

InstallPlan

Struct InstallPlan 

Source
pub struct InstallPlan { /* private fields */ }
Expand description

Everything a backend needs, resolved and validated.

Constructing one is where 05-infrastructure.md item 6 is actually satisfied: the binary path is made absolute and is confirmed to be a file before anything is registered, so a registration that would fail at boot is refused at install time instead.

Implementations§

Source§

impl InstallPlan

Source

pub fn resolve( identity: ServiceIdentity, request: &InstallRequest, directories: ServiceDirectories, ) -> Result<Self, ServiceError>

Resolves a request against this host.

§Errors

ServiceError::BinaryPath when the running executable cannot be located, and ServiceError::BinaryMissing when the path that would be registered is not a file.

Source

pub fn unchecked( identity: ServiceIdentity, start_mode: StartMode, binary: impl Into<PathBuf>, directories: ServiceDirectories, ) -> Self

Builds a plan from values a caller already holds, without touching the filesystem.

This is what makes the renderers testable on a host that has none of the paths involved: a Windows developer can render the systemd unit for /opt/runner-manager/bin/runner-manager and assert every line of it.

Source

pub const fn started_on_demand(self) -> Self

Registers without arming the manager’s automatic start. See InstallRequest::started_on_demand.

Source

pub const fn is_on_demand(&self) -> bool

Whether the manager was asked not to start this by itself.

Source

pub fn with_secret_guard(self, guard: impl Into<PathBuf>) -> Self

Names the file the machine-scoped secret store lives in, for the systemd LoadCredential= line.

InstallPlan::resolve fills this from d2; a test names it directly so that a Windows or macOS CI leg can assert the Linux unit’s credential line for a path that platform does not have.

Source

pub fn secret_guard(&self) -> Option<&Path>

The file the machine-scoped secret store lives in, when one resolved.

Source

pub const fn with_restart(self, restart: RestartPolicy) -> Self

Overrides the restart policy on an already-built plan.

Source

pub fn with_arguments<I, S>(self, arguments: I) -> Self
where I: IntoIterator<Item = S>, S: Into<OsString>,

Overrides the registered arguments on an already-built plan.

Source

pub const fn identity(&self) -> &ServiceIdentity

What the operating system calls this registration.

Source

pub const fn start_mode(&self) -> StartMode

Boot or login.

Source

pub fn binary(&self) -> &Path

The resolved absolute path of the binary to register.

Source

pub fn source_binary(&self) -> Option<&Path>

Where Self::binary was copied from, when it is a copy.

None is the legacy layout: the registration names the file a package manager owns, and cannot be upgraded while it runs. See InstallRequest::copied_from.

Source

pub fn arguments(&self) -> &[OsString]

The arguments it is registered with.

Source

pub const fn account(&self) -> &ServiceAccount

The account it runs under.

Source

pub const fn restart(&self) -> RestartPolicy

The restart-on-failure policy.

Source

pub const fn directories(&self) -> &ServiceDirectories

The four directories it was installed against.

Source

pub fn command_line(&self) -> String

The command line as one string, quoted the way each platform expects.

Trait Implementations§

Source§

impl Clone for InstallPlan

Source§

fn clone(&self) -> InstallPlan

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 InstallPlan

Source§

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

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

impl Eq for InstallPlan

Source§

impl PartialEq for InstallPlan

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InstallPlan

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<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