pub struct Runner { /* private fields */ }Expand description
The runner.
Implementations§
Source§impl Runner
impl Runner
Sourcepub async fn adopt(
&self,
manifest: &Path,
adoption: Adoption,
) -> Result<RunRecord>
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
impl Runner
Sourcepub fn expired(&self, now: SystemTime) -> Result<Vec<RunRecord>>
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.
Sourcepub async fn orphans(
&self,
cloud: Cloud,
place: &Place,
now: SystemTime,
) -> Result<Orphans>
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
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).
§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.
Sourcepub fn open(
&self,
manifest: &Path,
name: Option<RunName>,
) -> Result<Running<'_>>
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).
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 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.