Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Vaughn Dice <[email protected]>
Signed-off-by: James Sturtevant <[email protected]>
Signed-off-by: James Sturtevant <[email protected]>
  • Loading branch information
jsturtevant and vdice committed Jan 31, 2024
1 parent 050a87c commit 0d38599
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/containerd-shim-wasm/src/container/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ pub trait Engine: Clone + Send + Sync + 'static {
&["application/vnd.bytecodealliance.wasm.component.layer.v0+wasm"]
}

/// Precomiples a module that in in the WASM OCI layer format
/// Precompiles a module that is in the WASM OCI layer format
/// This is used to precompile a module before it is run and will be called if can_precompile returns true.
/// It is called only the first time a module is run and the resulting bytes will be cached in the containerd content store.
/// The cached, precompiled module will be reloaded on subsequent runs.
fn precompile(&self, _layers: &[Vec<u8>]) -> Result<Vec<u8>> {
bail!("precompilation not supported for this runtime")
}

/// Precomiple a module
/// Precompile a module
fn can_precompile() -> bool {
false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ impl Client {
self.update_image(image)?;

// The original image is considered a root object, by adding a ref to the new compiled content
// We tell to containerd to not garbage collect the new content until this image is removed from the system
// We tell containerd to not garbage collect the new content until this image is removed from the system
// this ensures that we keep the content around after the lease is dropped
log::debug!("updating content with precompile digest to avoid garbage collection");
let mut image_content = self.get_info(image_digest.clone())?;
Expand Down
1 change: 0 additions & 1 deletion crates/containerd-shim-wasmer/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ fn test_hello_world_oci() -> anyhow::Result<()> {
Ok(())
}


#[test]
#[serial]
fn test_custom_entrypoint() -> anyhow::Result<()> {
Expand Down
4 changes: 2 additions & 2 deletions crates/containerd-shim-wasmtime/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Engine for WasmtimeEngine {
fn precompile(&self, layers: &[Vec<u8>]) -> Result<Vec<u8>> {
match layers {
[layer] => self.engine.precompile_module(layer),
_ => bail!("only a single module is supported when when precompiling"),
_ => bail!("only a single module is supported when precompiling"),
}
}

Expand Down Expand Up @@ -209,7 +209,7 @@ impl WasmtimeEngine {
self.execute_module(module, store, &func)
}
Some(Precompiled::Component) => {
log::info!("using precompiled module");
log::info!("using precompiled component");
let component = unsafe { Component::deserialize(&self.engine, wasm_binary) }?;
self.execute_component(component, store, func)
}
Expand Down

0 comments on commit 0d38599

Please sign in to comment.