Skip to main content

aither_sandbox/spawn/
backend.rs

1//! Where a [`Sandbox`](crate::Sandbox) runs its processes.
2
3use heel::HeelBinary;
4
5use super::launch::{ContainerLaunch, RemoteLaunch};
6use crate::{ContainerShellRuntime, SshServer};
7
8/// Where a sandbox's processes run.
9///
10/// The embedder supplies what each backend runs: the verified `heel` binary on
11/// the host, the launch of the programs prepared in the container, the
12/// server's `heel` and launch. A host sandbox spawns programs and needs no
13/// shell; the shell a [`Shell`](crate::Shell) runs scripts under is given to
14/// [`Shell::builder_on_host`](crate::Shell::builder_on_host).
15#[derive(Debug, Clone)]
16pub enum Backend {
17    /// This machine, under heel's sandbox.
18    Host {
19        /// The verified `heel` binary the sandbox runs under.
20        heel: HeelBinary,
21    },
22    /// A running container, whose own limits are the boundary.
23    Container {
24        /// The container: its exec, its id, the workspace mount that maps host
25        /// paths into it and the [`HostRoute`](crate::HostRoute) that says
26        /// where the host is reachable from inside.
27        runtime: ContainerShellRuntime,
28        /// The programs prepared inside the container.
29        launch: ContainerLaunch,
30    },
31    /// A remote machine over SSH.
32    Ssh {
33        /// The server processes run on.
34        server: SshServer,
35        /// The `heel` binary on the server, as a path there; a confined
36        /// process needs it, an unconfined one does not.
37        heel: Option<String>,
38        /// The programs prepared on the server.
39        launch: RemoteLaunch,
40    },
41}