Skip to main content

IsolationBackend

Trait IsolationBackend 

Source
pub trait IsolationBackend: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn prepare<'life0, 'life1, 'async_trait>(
        &'life0 self,
        opts: &'life1 SpawnOpts,
    ) -> Pin<Box<dyn Future<Output = Result<IsolationEnv, MachiError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cleanup<'life0, 'life1, 'async_trait>(
        &'life0 self,
        env: &'life1 IsolationEnv,
    ) -> Pin<Box<dyn Future<Output = Result<(), MachiError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Prepares (and later tears down) an execution environment for a child agent.

Maturity: core (port). Default adapter is InProcessIsolation; worktree / OS sandbox are product adapters, not kernel defaults.

Required Methods§

Source

fn name(&self) -> &'static str

Stable backend id (in_process, worktree, …).

Source

fn prepare<'life0, 'life1, 'async_trait>( &'life0 self, opts: &'life1 SpawnOpts, ) -> Pin<Box<dyn Future<Output = Result<IsolationEnv, MachiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Allocate environment for this spawn.

§Errors

Backend-specific failures map to ErrorCode::HostIsolation.

Source

fn cleanup<'life0, 'life1, 'async_trait>( &'life0 self, env: &'life1 IsolationEnv, ) -> Pin<Box<dyn Future<Output = Result<(), MachiError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Release resources after the child turn finishes.

§Errors

Backend-specific failures.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§