Skip to content

Commit 3d4908a

Browse files
committed
make annotations public e.g., for containerd-shims
1 parent 5c75842 commit 3d4908a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

crates/containerd-shim-wasm/src/sandbox/context.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::borrow::Cow;
2+
use std::collections::HashMap;
23
use std::path::{Path, PathBuf};
34

45
use anyhow::{Context, bail};
@@ -32,6 +33,12 @@ pub trait RuntimeContext: Send + Sync {
3233
/// "my_module.wat" -> { source: File("my_module.wat"), func: "_start", name: "Some(my_module)", arg0: "my_module.wat" }
3334
/// "#init" -> { source: File(""), func: "init", name: None, arg0: "#init" }
3435
fn entrypoint(&self) -> Entrypoint;
36+
37+
/// Returns the annotations map from the OCI runtime spec, if any.
38+
///
39+
/// Annotations are provided by the runtime (for example `ctr --annotation key=value`) and
40+
/// are available on the `Spec` as a map of string key/values.
41+
fn annotations(&self) -> &Option<HashMap<String, String>>;
3542
}
3643

3744
/// The source for a WASI module / components.
@@ -136,6 +143,10 @@ impl RuntimeContext for WasiContext<'_> {
136143
name: module_name,
137144
}
138145
}
146+
147+
fn annotations(&self) -> &Option<HashMap<String, String>> {
148+
self.spec.annotations()
149+
}
139150
}
140151

141152
/// The type of a wasm binary.

0 commit comments

Comments
 (0)