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 adopt( &self, manifest: &Path, adoption: Adoption, ) -> Result<RunRecord>

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

use isothrum_runner::{Adoption, RunName};

// A deployment applied by hand from `.isoloom/cloud-vm/aws/`, its state in `old/`.
let adoption = Adoption::new(RunName::new("shop")?, "old")
    .with_params([("region".to_owned(), "eu-west-3".to_owned())])
    .with_started_at("2026-10-15T11:00:00Z");
let record = runner.adopt(".isoloom/cloud-vm/aws/run.json".as_ref(), adoption).await?;
// From now on, `runner.open(…)?.down(…)` destroys it as it was applied.
§Errors

Fails with adopt_refused when the manifest isn’t a Terraform one, when the run already has a record that isn’t absent or a state, when the old folder holds no state, or when the slot it was applied in (Adoption::with_slot) is out of range or another run on its place holds it; with slots_full when it names no slot and none is free on its place; with locked while another operation holds the run or another process picks a slot past the wait; with manifest_invalid or io when the manifest can’t be read; 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 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 files only.

§Errors

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

Source

pub async fn orphans( &self, cloud: Cloud, place: &Place, now: SystemTime, ) -> Result<Orphans>

What cloud holds in place tagged with an expiry past now that no recorded run’s Terraform state covers. A command line that is missing or fails is said in Orphans::unread, never an error: the sweep goes on.

§Errors

Fails with io when a record or a recorded run’s Terraform state can’t be read or parsed: what that state holds is unknown, so nothing could be told an orphan.

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

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

Source

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

Reads and checks the manifest at manifest, as run name (default: the manifest’s environment.name).

§Errors

Fails as load_manifest does; with run_name when the run’s name can’t name a run; with unsupported when this runner can’t run the manifest here (its target doesn’t run on this host, or it has a delivery its driver doesn’t take).

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