From 7d70f406e38dc1b64822bce0e32696481ebd3487 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Fri, 4 Aug 2023 18:13:07 +0000 Subject: [PATCH] Add comment on the new function Signed-off-by: James Sturtevant --- crates/containerd-shim-wasm/src/sandbox/oci.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/containerd-shim-wasm/src/sandbox/oci.rs b/crates/containerd-shim-wasm/src/sandbox/oci.rs index baba4496e..3657ba509 100644 --- a/crates/containerd-shim-wasm/src/sandbox/oci.rs +++ b/crates/containerd-shim-wasm/src/sandbox/oci.rs @@ -35,6 +35,17 @@ pub fn get_args(spec: &Spec) -> &[String] { } } +// get_module returns the module name and exported function name to be called +// from the arguments on the runtime spec process field. The first argument will +// be the module name and the default function name is "_start". +// +// If there is a '#' in the argument it will split the string +// returning the first part as the module name and the second part as the function +// name. +// +// example: "module.wasm#function" will return (Some("module.wasm"), "function") +// +// If there are no arguments then it will return (None, "_start") pub fn get_module(spec: &Spec) -> (Option, String) { let args = get_args(spec);