Skip to main content

Runner

Struct Runner 

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

The runner.

Implementations§

Source§

impl Runner

Source

pub async fn address_blocks_in_use( &self, except: Option<&RunName>, docker_context: Option<&str>, ) -> Result<Vec<String>>

The IPv4 address blocks (CIDR, 172.17.0.0/16) the networks of the engine Docker context docker_context reaches (the current one when none is named) hold, but those of run except’s own networks (left from an earlier start): what a deployment’s networks must stay clear of. IPv6 blocks are left out.

§Errors

Docker is missing, or the engine can’t say (it doesn’t answer, a network went while it was read).

Source§

impl Runner

Source

pub async fn adopt( &self, module: &Path, adoption: Adoption, ) -> Result<RunRecord>

Adopts the existing Terraform deployment adoption describes, one applied from the module in folder module outside the runner, as a run of that module: its state moves into the run’s state folder, and the run is recorded as up; status, update, down and the reaper then act on it like any other run. A run whose record an earlier down left absent adopts one too, its record replaced. Once adopted, the old folder holds no state: adopting it again is refused, never a second copy.

§Errors

Fails with project_invalid when module isn’t a Terraform module; with adopt_refused when the run already has a record that isn’t absent or a state, or when the old folder holds no state; with locked while another operation holds the run; and with io when a file can’t be moved or the record written (the state is put back then).

Source§

impl Runner

Source

pub async fn adopt_downloads( &self, adopted: &[DownloadToAdopt], ) -> Result<Vec<Download>>

Records adopted as downloads with no run, each one on this computer now: an image while its reference stands for the id given (any, when none is), a box for each architecture Vagrant holds it in. One recorded already keeps its row. With no engine or no Vagrant installed, nothing of that kind is held, so nothing of it is adopted. The downloads recorded for adopted, new or not.

§Errors

The engine or Vagrant couldn’t say what they hold (adopt again later: nothing was recorded); the store can’t be written.

Source§

impl Runner

Source

pub async fn downloads(&self) -> Result<Vec<Download>>

Every download the home’s runs fetched and the store records, oldest first, each with its size when it can be read.

§Errors

The store can’t be read.

Source

pub async fn remove_downloads( &self, which: &DownloadsToRemove, ) -> Result<Vec<DownloadRemoval>>

Removes the recorded downloads which names, each on its own: an image by its reference (docker image rm, never forced) while the reference still stands for the recorded id, a box by its name, provider, version and architecture (vagrant box remove, never forced). One its tool refuses (in use) or fails to remove is said in its outcome and kept with its record; the others go on. The record of one removed, gone already, or whose reference now stands for another image is forgotten. Nothing the store doesn’t record is removed.

§Errors

The store can’t be read or written.

Source§

impl Runner

Source

pub fn expired(&self, now: SystemTime) -> Result<Vec<RunRecord>>

The recorded runs whose expiry passed at now and whose last operation didn’t leave them absent: the reaper’s input. Reads the store only.

§Errors

Fails as the store does when a record can’t be read.

Source§

impl Runner

Source

pub fn new(config: RunnerConfig) -> Result<Runner>

A runner with config; its home (with its missing parents) and the home’s runs/ folder are created, owner-only (on Windows, a home outside the user’s profile gets an owner-only DACL), and its store (state.db) opened: made, migrated, or imported from a 2.x home’s files (crate::store::Store::open).

§Errors

Fails with io when the home can’t be created or made owner-only (on Windows, its owner can’t be read or its DACL set), or its runs/ folder can’t be created; as crate::store::Store::open does for the store.

Source

pub fn open(&self, dir: &Path, name: Option<RunName>) -> Result<Running<'_>>

The project in folder dir (a file in it names its folder), of the format its files show (Format::detect), as run name (default: the folder’s name, made a run name). Nothing runs: a folder that isn’t a project is refused before any tool.

§Errors

project_invalid when the folder holds no format’s files, or several; run_name when the name can’t name a run.

Source

pub fn open_as( &self, dir: &Path, format: Format, name: Option<RunName>, ) -> Result<Running<'_>>

The project in folder dir, of format format (the one to run when its files show several), as run name (Runner::open).

§Errors

project_invalid when the folder holds no format files; run_name when the name can’t name a run.

Source

pub fn reopen(&self, name: &RunName) -> Result<Running<'_>>

Recorded run name, opened again from the folder and format it was started with.

§Errors

not_running when no run of that name is recorded; as Runner::open_as for its folder.

Source

pub fn runs(&self) -> Result<Vec<RunRecord>>

Every recorded run, with the state its last operation left it in. Reads files only.

§Errors

Fails with io when a record can’t be read.

Source

pub fn run_record(&self, name: &RunName) -> Result<Option<RunRecord>>

Run name’s record, with the state its last operation left it in; None for a run never recorded. Reads one file: an embedder asking after one run doesn’t fail on another run’s record it can’t read, as it would reading Runner::runs.

§Errors

Fails with io when the record is there and can’t be read.

Source

pub fn copy_key(&self, name: &RunName) -> String

The key of run name’s copy on this runner (copy_key).

Source

pub fn events(&self, name: &RunName) -> Result<EventLog>

Run name’s logged events, oldest first, with how many of its lines it couldn’t read as one (written by another version of the runner, or cut short).

§Errors

Fails with io when the run’s event log can’t be read.

Source

pub async fn ssh_public_key(&self) -> Result<String>

The public half of the runner’s SSH key, one line: what an embedder authorizes where a run’s SSH goes (a Proxmox node it jumps through). The key is made when the runner has none.

§Errors

Fails with tool_missing when ssh-keygen isn’t installed, tool_failed or timeout when it can’t make the key, and io when the runner’s ssh/ folder can’t be created or its public key can’t be read.

Trait Implementations§

Source§

impl Debug for Runner

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Runner

§

impl !RefUnwindSafe for Runner

§

impl !UnwindSafe for Runner

§

impl Forget for Runner

§

impl Move for Runner

§

impl Send for Runner

§

impl Sync for Runner

§

impl Unpin for Runner

§

impl UnsafeUnpin for Runner

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> 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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