Skip to main content

SandboxExecutor

Trait SandboxExecutor 

Source
pub trait SandboxExecutor: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn isolation_level(&self) -> IsolationLevel;
    fn is_available(&self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>;
    fn execute(
        &self,
        command: SandboxCommand,
    ) -> Pin<Box<dyn Future<Output = Result<ExecutionResult, ReactError>> + Send + '_>>;

    // Provided methods
    fn execute_with_limits(
        &self,
        command: SandboxCommand,
        limits: ResourceLimits,
    ) -> Pin<Box<dyn Future<Output = Result<ExecutionResult, ReactError>> + Send + '_>> { ... }
    fn cleanup(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<(), ReactError>> + Send + '_>> { ... }
}
Expand description

Sandbox executor unified interface.

All three layers (Local / Docker / K8s) implement this trait.

Required Methods§

Source

fn name(&self) -> &str

Executor name

Source

fn isolation_level(&self) -> IsolationLevel

Current isolation level

Source

fn is_available(&self) -> Pin<Box<dyn Future<Output = bool> + Send + '_>>

Check if the executor is available

Source

fn execute( &self, command: SandboxCommand, ) -> Pin<Box<dyn Future<Output = Result<ExecutionResult, ReactError>> + Send + '_>>

Execute a command

Provided Methods§

Source

fn execute_with_limits( &self, command: SandboxCommand, limits: ResourceLimits, ) -> Pin<Box<dyn Future<Output = Result<ExecutionResult, ReactError>> + Send + '_>>

Execute a command with resource limits

Source

fn cleanup( &self, ) -> Pin<Box<dyn Future<Output = Result<(), ReactError>> + Send + '_>>

Clean up sandbox resources (containers, temp files, etc.)

Implementors§