pub enum Reach {
Here,
Subprocess {
command: String,
args: Vec<String>,
cwd: Option<PathBuf>,
env: BTreeMap<String, String>,
timeout_ms: u64,
persistent: bool,
},
Wasm {
module: PathBuf,
fuel: Option<u64>,
},
Remote {
endpoint: String,
timeout_ms: u64,
},
}Expand description
How this process gets to an environment.
Separate from the environment itself: it is the road, not the destination.
Variants§
Here
The environment is this process.
Implementations here are Rust functions compiled in, or bodies the interpreter walks. Nothing is serialized and nothing is spawned.
Subprocess
A child process, started when needed and spoken to over its standard streams.
Fields
persistent: boolKeep the process alive between calls.
Starting an interpreter costs more than most calls do — around twenty milliseconds for Python — so a program calling repeatedly pays that over and over for nothing. A worker pays it once.
The cost is that state now survives between calls, which is exactly what one process per call was free of. Off by default for that reason: a module that holds nothing between calls says so.
Wasm
A WebAssembly module instantiated in this process.
The only environment that is actually a sandbox: a guest gets memory and nothing else — no files, no sockets, no clock — and runs on a budget, so a proof that never finishes stops rather than taking this process with it. There is no operating system process to kill here, which is why the budget matters more than a timeout would.
Fields
Remote
Something already running that this process talks to.
Implementations§
Source§impl Reach
impl Reach
Sourcepub fn timeout_ms(&self) -> Option<u64>
pub fn timeout_ms(&self) -> Option<u64>
How long to wait for an answer, where waiting is a thing that happens.
Sourcepub fn is_persistent(&self) -> bool
pub fn is_persistent(&self) -> bool
Whether the process is kept alive between calls.