Skip to main content

RemoteSandbox

Trait RemoteSandbox 

Source
pub trait RemoteSandbox:
    Send
    + Sync
    + Debug {
    // Required method
    fn execute<'a>(
        &'a self,
        language: &'a str,
        code: &'a str,
        inputs: Value,
        limits: CodeLimits,
    ) -> BoxFuture<'a, Result<Value, NodeError>>;

    // Provided method
    fn execute_detailed<'a>(
        &'a self,
        language: &'a str,
        code: &'a str,
        inputs: Value,
        limits: CodeLimits,
    ) -> BoxFuture<'a, Result<SandboxRun, NodeError>> { ... }
}
Expand description

A sandbox that executes code out of process (for languages without an embedded engine).

Register it as Arc<dyn RemoteSandbox> in graphrt_core::Services.

Required Methods§

Source

fn execute<'a>( &'a self, language: &'a str, code: &'a str, inputs: Value, limits: CodeLimits, ) -> BoxFuture<'a, Result<Value, NodeError>>

Execute code in language with inputs (a JSON object). Must return the JSON object produced by the code’s main function.

Provided Methods§

Source

fn execute_detailed<'a>( &'a self, language: &'a str, code: &'a str, inputs: Value, limits: CodeLimits, ) -> BoxFuture<'a, Result<SandboxRun, NodeError>>

Like RemoteSandbox::execute, also returning diagnostics (captured output, limits that could not be applied). The default reports none.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§