pub struct WasmConfig {
pub created: DateTime<Utc>,
pub author: Option<String>,
pub architecture: String,
pub os: String,
pub layer_digests: Vec<String>,
pub component: Option<Component>,
}
Expand description
The config type struct for application/wasm
Fields§
§created: DateTime<Utc>
The time when the config was created.
The optional name of the author of the config.
architecture: String
The architecture of the artifact. This is always wasm
.
os: String
The OS name of the artifact. Possible options: wasip1, wasip2. For plain wasm, this should be wasip1 as this must match a GOOS value and it doesn’t have one for plain Wasm
Eventually this will go away when we hit a 1.0 but we need it for now
layer_digests: Vec<String>
This field contains a list of digests of each of the layers from the manifest in the same order as they are listed in the manfiest. This exists because we need to have a unique list here so that the hash of the config (used as the ID) is unique every time (https://github.com/opencontainers/image-spec/pull/1173)
component: Option<Component>
Information about the component in the manifest. This is required when the os
field is
wasip2
Implementations§
source§impl WasmConfig
impl WasmConfig
sourcepub async fn from_component(
path: impl AsRef<Path>,
author: Option<String>,
) -> Result<(Self, ImageLayer)>
pub async fn from_component( path: impl AsRef<Path>, author: Option<String>, ) -> Result<(Self, ImageLayer)>
A helper for loading a component from a file and returning the proper config and
ImageLayer
. The returned config will have the created time set to now and all other
fields set for a component.
sourcepub fn from_raw_component(
raw: Vec<u8>,
author: Option<String>,
) -> Result<(Self, ImageLayer)>
pub fn from_raw_component( raw: Vec<u8>, author: Option<String>, ) -> Result<(Self, ImageLayer)>
Same as WasmConfig::from_component
but for raw component bytes
sourcepub async fn from_module(
path: impl AsRef<Path>,
author: Option<String>,
) -> Result<(Self, ImageLayer)>
pub async fn from_module( path: impl AsRef<Path>, author: Option<String>, ) -> Result<(Self, ImageLayer)>
A helper for loading a plain wasm module and returning the proper config and ImageLayer
.
The returned config will have the created time set to now and all other fields set for a
plain wasm module.
sourcepub fn from_raw_module(
raw: Vec<u8>,
author: Option<String>,
) -> Result<(Self, ImageLayer)>
pub fn from_raw_module( raw: Vec<u8>, author: Option<String>, ) -> Result<(Self, ImageLayer)>
Same as WasmConfig::from_module
but for raw module bytes
sourcepub fn with_annotations(
&self,
annotations: BTreeMap<String, String>,
) -> AnnotatedWasmConfig<'_>
pub fn with_annotations( &self, annotations: BTreeMap<String, String>, ) -> AnnotatedWasmConfig<'_>
Adds annotations to this WasmConfig
.