1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! This module provides abstractions for managing WebAssembly containers in a sandboxed environment.
//!
//! This module gives you complete control over the container lifecycle and sandboxing,
//! compared to the higher-level container module. It's useful when you need:
//!
//! - Custom sandboxing requirements
//! - Direct control over container lifecycle
//! - Support MacOS or Windows
//!
//! There are also some downsides to using this module:
//!
//! - No precompilation out-of-the-box
//! - Does not support for native Linux containers out-of-the-box
//! - Requires manual handling of cgroup setup
//!
//! ## Key Components
//!
//! - [`Instance`]: Core trait for implementing container lifecycle management
//! - [`cli`]: Command line interface for the containerd shim
//!
//! ## Example Usage
//!
//! ```rust,no_run
//! use containerd_shim_wasm::sandbox::{Instance, InstanceConfig, Error};
//! use chrono::{DateTime, Utc};
//! use std::time::Duration;
//! use anyhow::Result;
//!
//! #[derive(Clone, Default)]
//! struct MyInstance;
//!
//! impl Instance for MyInstance {
//! async fn new(id: String, cfg: &InstanceConfig) -> Result<Self, Error> {
//! Ok(MyInstance)
//! }
//!
//! async fn start(&self) -> Result<u32, Error> {
//! Ok(1)
//! }
//!
//! async fn kill(&self, signal: u32) -> Result<(), Error> {
//! Ok(())
//! }
//!
//! async fn delete(&self) -> Result<(), Error> {
//! Ok(())
//! }
//!
//! async fn wait(&self) -> (u32, DateTime<Utc>) {
//! (0, Utc::now())
//! }
//! }
//! ```
//!
//! For simpler use cases, consider using the [`crate::container`] module instead.
pub use ;
pub use ;
pub use Config;
pub use Shim;
pub
pub
pub