@@ -8,7 +8,6 @@ use futures_util::future;
88use futures_util:: stream:: { self , StreamExt , TryStreamExt } ;
99use oci_distribution:: {
1010 client:: { Config , ImageLayer } ,
11- errors:: OciDistributionError ,
1211 manifest:: { OciImageManifest , OCI_IMAGE_MEDIA_TYPE } ,
1312 secrets:: RegistryAuth ,
1413 token_cache:: RegistryTokenType ,
@@ -37,7 +36,6 @@ const WASM_LAYER_MEDIA_TYPE_LEGACY: &str = "application/vnd.wasm.content.layer.v
3736
3837// TODO: use canonical types defined upstream; see https://github.com/bytecodealliance/registry/pull/146
3938const WASM_LAYER_MEDIA_TYPE : & str = "application/vnd.bytecodealliance.wasm.component.layer.v0+wasm" ;
40- const COMPONENT_ARTIFACT_TYPE : & str = "application/vnd.bytecodealliance.component.v1+wasm" ;
4139
4240const CONFIG_FILE : & str = "config.json" ;
4341const LATEST_TAG : & str = "latest" ;
@@ -184,8 +182,8 @@ impl Client {
184182 media_type : OCI_IMAGE_MEDIA_TYPE . to_string ( ) ,
185183 annotations : None ,
186184 } ;
187- let mut manifest = OciImageManifest :: build ( & layers, & oci_config, None ) ;
188- manifest . artifact_type = Some ( COMPONENT_ARTIFACT_TYPE . to_string ( ) ) ;
185+ let manifest = OciImageManifest :: build ( & layers, & oci_config, None ) ;
186+
189187 let response = self
190188 . oci
191189 . push ( & reference, & layers, oci_config, & auth, Some ( manifest) )
@@ -315,7 +313,6 @@ impl Client {
315313 || this. cache . data_file ( & layer. digest ) . is_ok ( )
316314 {
317315 tracing:: debug!( "Layer {} already exists in cache" , & layer. digest) ;
318- <<<<<<< HEAD
319316 return anyhow:: Ok ( ( ) ) ;
320317 }
321318
@@ -325,52 +322,19 @@ impl Client {
325322 . pull_blob ( & reference, & layer. digest , & mut bytes)
326323 . await ?;
327324 match layer. media_type . as_str ( ) {
328- WASM_LAYER_MEDIA_TYPE => {
325+ SPIN_APPLICATION_MEDIA_TYPE => {
326+ this. write_locked_app_config ( & reference. to_string ( ) , & bytes)
327+ . await
328+ . with_context ( || "unable to write locked app config to cache" ) ?;
329+ }
330+ WASM_LAYER_MEDIA_TYPE | WASM_LAYER_MEDIA_TYPE_LEGACY => {
329331 this. cache . write_wasm ( & bytes, & layer. digest ) . await ?;
330332 }
331333 ARCHIVE_MEDIATYPE => {
332334 this. unpack_archive_layer ( & bytes, & layer. digest ) . await ?;
333335 }
334336 _ => {
335337 this. cache . write_data ( & bytes, & layer. digest ) . await ?;
336- =======
337- } else {
338- tracing : : debug ! ( "Pulling layer {}" , & layer. digest) ;
339- let mut bytes = Vec :: new ( ) ;
340- match this
341- . oci
342- . pull_blob ( & reference, & layer. digest , & mut bytes)
343- . await
344- {
345- Err ( e) => return Err ( e) ,
346- _ => match layer. media_type . as_str ( ) {
347- // If the locked app config is present as a separate layer, this should take precedence
348- SPIN_APPLICATION_MEDIA_TYPE => {
349- if let Err ( e) = this. write_locked_app_config ( & reference. to_string ( ) , & bytes)
350- . await
351- {
352- return Err ( OciDistributionError :: GenericError (
353- Some ( format ! ( "unable to write locked app config to cache: {}" , e) )
354- ) ) ;
355- }
356- }
357- WASM_LAYER_MEDIA_TYPE | WASM_LAYER_MEDIA_TYPE_LEGACY => {
358- let _ = this. cache . write_wasm ( & bytes, & layer. digest ) . await ;
359- }
360- ARCHIVE_MEDIATYPE => {
361- if let Err ( e) =
362- this. unpack_archive_layer ( & bytes, & layer. digest ) . await
363- {
364- return Err ( OciDistributionError :: GenericError ( Some (
365- format ! ( "unable to unpack archive layer with digest {}: {}" , & layer. digest, e) ,
366- ) ) ) ;
367- }
368- }
369- _ => {
370- let _ = this. cache . write_data ( & bytes, & layer. digest ) . await ;
371- }
372- } ,
373- >>>>>>> 942 a1782 ( feat( oci) : manifest/config updates to support containerd)
374338 }
375339 }
376340 Ok ( ( ) )
0 commit comments