pub trait Sandbox:
Send
+ Sync
+ 'static {
// Provided methods
fn create_sandbox(
&self,
create_sandbox_request: CreateSandboxRequest,
) -> impl Future<Output = Result<CreateSandboxResponse>> + Send { ... }
fn start_sandbox(
&self,
start_sandbox_request: StartSandboxRequest,
) -> impl Future<Output = Result<StartSandboxResponse>> + Send { ... }
fn platform(
&self,
platform_request: PlatformRequest,
) -> impl Future<Output = Result<PlatformResponse>> + Send { ... }
fn stop_sandbox(
&self,
stop_sandbox_request: StopSandboxRequest,
) -> impl Future<Output = Result<StopSandboxResponse>> + Send { ... }
fn wait_sandbox(
&self,
wait_sandbox_request: WaitSandboxRequest,
) -> impl Future<Output = Result<WaitSandboxResponse>> + Send { ... }
fn sandbox_status(
&self,
sandbox_status_request: SandboxStatusRequest,
) -> impl Future<Output = Result<SandboxStatusResponse>> + Send { ... }
fn ping_sandbox(
&self,
ping_request: PingRequest,
) -> impl Future<Output = Result<PingResponse>> + Send { ... }
fn shutdown_sandbox(
&self,
shutdown_sandbox_request: ShutdownSandboxRequest,
) -> impl Future<Output = Result<ShutdownSandboxResponse>> + Send { ... }
}Expand description
Sandbox is an optional interface that shim may implement to support sandboxes environments. A typical example of sandbox is microVM or pause container - an entity that groups containers and/or holds resources relevant for this group.
Provided Methods§
Sourcefn create_sandbox(
&self,
create_sandbox_request: CreateSandboxRequest,
) -> impl Future<Output = Result<CreateSandboxResponse>> + Send
fn create_sandbox( &self, create_sandbox_request: CreateSandboxRequest, ) -> impl Future<Output = Result<CreateSandboxResponse>> + Send
CreateSandbox will be called right after sandbox shim instance launched. It is a good place to initialize sandbox environment.
Sourcefn start_sandbox(
&self,
start_sandbox_request: StartSandboxRequest,
) -> impl Future<Output = Result<StartSandboxResponse>> + Send
fn start_sandbox( &self, start_sandbox_request: StartSandboxRequest, ) -> impl Future<Output = Result<StartSandboxResponse>> + Send
StartSandbox will start previsouly created sandbox.
Sourcefn platform(
&self,
platform_request: PlatformRequest,
) -> impl Future<Output = Result<PlatformResponse>> + Send
fn platform( &self, platform_request: PlatformRequest, ) -> impl Future<Output = Result<PlatformResponse>> + Send
Platform queries the platform the sandbox is going to run containers on. containerd will use this to generate a proper OCI spec.
Sourcefn stop_sandbox(
&self,
stop_sandbox_request: StopSandboxRequest,
) -> impl Future<Output = Result<StopSandboxResponse>> + Send
fn stop_sandbox( &self, stop_sandbox_request: StopSandboxRequest, ) -> impl Future<Output = Result<StopSandboxResponse>> + Send
StopSandbox will stop existing sandbox instance
Sourcefn wait_sandbox(
&self,
wait_sandbox_request: WaitSandboxRequest,
) -> impl Future<Output = Result<WaitSandboxResponse>> + Send
fn wait_sandbox( &self, wait_sandbox_request: WaitSandboxRequest, ) -> impl Future<Output = Result<WaitSandboxResponse>> + Send
WaitSandbox blocks until sanbox exits.
Sourcefn sandbox_status(
&self,
sandbox_status_request: SandboxStatusRequest,
) -> impl Future<Output = Result<SandboxStatusResponse>> + Send
fn sandbox_status( &self, sandbox_status_request: SandboxStatusRequest, ) -> impl Future<Output = Result<SandboxStatusResponse>> + Send
SandboxStatus will return current status of the running sandbox instance
Sourcefn ping_sandbox(
&self,
ping_request: PingRequest,
) -> impl Future<Output = Result<PingResponse>> + Send
fn ping_sandbox( &self, ping_request: PingRequest, ) -> impl Future<Output = Result<PingResponse>> + Send
PingSandbox is a lightweight API call to check whether sandbox alive.
Sourcefn shutdown_sandbox(
&self,
shutdown_sandbox_request: ShutdownSandboxRequest,
) -> impl Future<Output = Result<ShutdownSandboxResponse>> + Send
fn shutdown_sandbox( &self, shutdown_sandbox_request: ShutdownSandboxRequest, ) -> impl Future<Output = Result<ShutdownSandboxResponse>> + Send
ShutdownSandbox must shutdown shim instance.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.