Trait RuntimeContext

Source
pub trait RuntimeContext: Send + Sync {
    // Required methods
    fn args(&self) -> &[String];
    fn envs(&self) -> &[String];
    fn entrypoint(&self) -> Entrypoint<'_>;
}
Expand description

The RuntimeContext trait provides access to the runtime context that includes the arguments, environment variables, and entrypoint for the container.

Required Methods§

Source

fn args(&self) -> &[String]

Returns arguments from the runtime spec process field, including the path to the entrypoint executable.

Source

fn envs(&self) -> &[String]

Returns environment variables in the format ENV_VAR_NAME=VALUE from the runtime spec process field.

Source

fn entrypoint(&self) -> Entrypoint<'_>

Returns a Entrypoint with the following fields obtained from the first argument in the OCI spec for entrypoint:

  • arg0 - raw entrypoint from the OCI spec
  • name - provided as the file name of the module in the entrypoint without the extension
  • func - name of the exported function to call, obtained from the arguments on process OCI spec.
  • Source - either a File(PathBuf) or Oci(WasmLayer). When a File source the PathBuf`` is provided by entrypoint in OCI spec. If the image contains custom OCI Wasm layers, the source is provided as an array of WasmLayer` structs.

The first argument in the OCI spec for entrypoint is specified as path#func where func is optional and defaults to _start, e.g.: “/app/app.wasm#entry” -> { source: File(“/app/app.wasm”), func: “entry”, name: “Some(app)”, arg0: “/app/app.wasm#entry” } “my_module.wat” -> { source: File(“my_module.wat”), func: “_start”, name: “Some(my_module)”, arg0: “my_module.wat” } “#init” -> { source: File(“”), func: “init”, name: None, arg0: “#init” }

Implementors§