Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ghcr.io/componentized/oci/client:0.1.0-dev@sha256:a5c60dc24dea1883e347f67a7f3929694b620c8096fb4afff54cb8b9fbc95004
ghcr.io/componentized/oci/client:0.1.0-dev_debug@sha256:075eecc73333b82ce0854907e06015296f7c3a839539d7b5457bec31d95e7a00
ghcr.io/componentized/oci/client:0.1.0-dev@sha256:f8803d55c62f994c2e134e2b821ab8a400bf379179a0941c4396ad54d21664f6
ghcr.io/componentized/oci/client:0.1.0-dev_debug@sha256:5972e075b6dc9eff04ef7e986b81526ee657fb671ba3c8bec4e3aab61e70f2d6
21 changes: 11 additions & 10 deletions components/oci-loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{
componentized::{
component::types::{ErrorCode, Malformed, Wasm},
oci::client::{self as oci, Digest, Reference},
oci::media_types,
},
exports::componentized::component::path_loader::Guest,
};
Expand All @@ -23,23 +24,21 @@ async fn load_reference(path: &str) -> Result<Wasm, ErrorCode> {
oci::Manifest::OciImageV1(oci_image_manifest_v1) => oci_image_manifest_v1,
_ => Err(ErrorCode::Other(Some("unexpected manifest".to_string())))?,
};
match manifest.config.media_type {
oci::MediaType::ApplicationVndWasmConfigV0(oci::MediaTypeSuffix::Json) => {}
_ => Err(ErrorCode::Other(Some(
if manifest.config.media_type != media_types::application_vnd_wasm_config_v0_json() {
Err(ErrorCode::Other(Some(
"unexpected config media type".to_string(),
)))?,
};
)))?
}
if manifest.layers.len() != 1 {
Err(ErrorCode::Other(Some(
"unknown artifact layout".to_string(),
)))?
}
let component_descriptor = manifest.layers.first().unwrap();
match component_descriptor.media_type {
oci::MediaType::ApplicationWasm => {}
_ => Err(ErrorCode::Other(Some(
if component_descriptor.media_type != media_types::application_wasm() {
Err(ErrorCode::Other(Some(
"unknown artifact media type".to_string(),
)))?,
)))?
}

let config_reference = manifest_reference.with_digest(&manifest.config.digest);
Expand All @@ -54,7 +53,9 @@ async fn load_reference(path: &str) -> Result<Wasm, ErrorCode> {

let component_reference =
manifest_reference.with_digest(&manifest.layers.first().unwrap().digest);
let component = oci::get_blob(component_reference).await?;
let (component, verified) = oci::get_blob(component_reference).await?;
let component = component.collect().await;
verified.await?;
if component_descriptor.size != component.len() as u64 {
Err(ErrorCode::Malformed(Malformed {
name: None,
Expand Down
4 changes: 2 additions & 2 deletions components/test-loader/test-loader.wac
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ let oci-client = new local:dep-componentized-oci-client {

export new local:test-loader-harness {
path-loader: new local:path-loader {
"componentized:http/client@0.1.0": http-client.client,
"componentized:oci/client@0.0.0-dev": oci-client.client,
...http-client,
...oci-client,
...
}.path-loader,
...
Expand Down
3 changes: 2 additions & 1 deletion components/wit/worlds.wit
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ world http-loader {
}

world oci-loader {
import componentized:oci/client@0.0.0-dev;
import componentized:oci/client@0.1.0;
import componentized:oci/media-types@0.1.0;
import componentized:component/types@0.0.0-dev;
export componentized:component/path-loader@0.0.0-dev;
}
Expand Down
10 changes: 10 additions & 0 deletions components/wkg.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ requirement = "=0.0.0-dev"
version = "0.0.0-dev"
digest = "sha256:fe33e6ac5f37a1a5f37b249c382b28e5224d4f2b28a7b6f8499a8bb11762e400"

[[packages.versions]]
requirement = "=0.1.0-dev"
version = "0.1.0-dev"
digest = "sha256:15c5e31aec2cffa766de8d19dfd01cd17cae26528c207a1a13f2958da1304348"

[[packages.versions]]
requirement = "=0.1.0"
version = "0.1.0"
digest = "sha256:669209f655930f3a48412a6ee4e29371d86db6ba001b3b3d78aff0f1839f6fdb"

[[packages]]
name = "wasi:cli"
registry = "wasi.dev"
Expand Down
2 changes: 1 addition & 1 deletion tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ publish = false
path = "lib.rs"

[dependencies]
componentized-constants-cli = "=0.1.0-dev"
componentized-constants-cli = "=0.1.1"
static-config = "=0.2.0"
wac-cli = "=0.12.0"
wasm-tools = "=1.261.0"
Expand Down
Loading