pub struct Runner { /* private fields */ }Expand description
The runner.
Implementations§
Source§impl Runner
impl Runner
Sourcepub async fn address_blocks_in_use(
&self,
except: Option<&RunName>,
docker_context: Option<&str>,
) -> Result<Vec<String>>
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
impl Runner
Sourcepub async fn adopt(
&self,
module: &Path,
adoption: Adoption,
) -> Result<RunRecord>
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
impl Runner
Sourcepub async fn adopt_downloads(
&self,
adopted: &[DownloadToAdopt],
) -> Result<Vec<Download>>
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
impl Runner
Sourcepub async fn downloads(&self) -> Result<Vec<Download>>
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.
Sourcepub async fn remove_downloads(
&self,
which: &DownloadsToRemove,
) -> Result<Vec<DownloadRemoval>>
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
impl Runner
Sourcepub fn new(config: RunnerConfig) -> Result<Runner>
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.
Sourcepub fn open(&self, dir: &Path, name: Option<RunName>) -> Result<Running<'_>>
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.
Sourcepub fn open_as(
&self,
dir: &Path,
format: Format,
name: Option<RunName>,
) -> Result<Running<'_>>
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.
Sourcepub fn reopen(&self, name: &RunName) -> Result<Running<'_>>
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.
Sourcepub fn runs(&self) -> Result<Vec<RunRecord>>
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.
Sourcepub fn run_record(&self, name: &RunName) -> Result<Option<RunRecord>>
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.
Sourcepub fn copy_key(&self, name: &RunName) -> String
pub fn copy_key(&self, name: &RunName) -> String
The key of run name’s copy on this runner (copy_key).
Sourcepub fn events(&self, name: &RunName) -> Result<EventLog>
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.
Sourcepub async fn ssh_public_key(&self) -> Result<String>
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.