File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ struct GetBlobOpts {
2929enum Opt {
3030 GetMetadata ( GetMetadataOpts ) ,
3131 GetBlob ( GetBlobOpts ) ,
32+ FetchContainerToDevNull ( GetMetadataOpts ) ,
3233}
3334
3435#[ derive( serde:: Serialize , Debug ) ]
@@ -69,10 +70,28 @@ async fn get_blob(o: GetBlobOpts) -> Result<()> {
6970 Ok ( ( ) )
7071}
7172
73+ async fn fetch_container_to_devnull ( o : GetMetadataOpts ) -> Result < ( ) > {
74+ let proxy = containers_image_proxy:: ImageProxy :: new ( ) . await ?;
75+ let img = & proxy. open_image ( & o. reference ) . await ?;
76+ let manifest = proxy. fetch_manifest ( img) . await ?. 1 ;
77+ for layer in manifest. layers ( ) {
78+ let ( mut blob, driver) = proxy. get_descriptor ( img, layer) . await ?;
79+ let mut devnull = tokio:: io:: sink ( ) ;
80+ let copier = tokio:: io:: copy ( & mut blob, & mut devnull) ;
81+ let ( copier, driver) = tokio:: join!( copier, driver) ;
82+ dbg ! ( & copier) ;
83+ dbg ! ( & driver) ;
84+ copier?;
85+ driver?;
86+ }
87+ Ok ( ( ) )
88+ }
89+
7290async fn run ( ) -> Result < ( ) > {
7391 match Opt :: parse ( ) {
7492 Opt :: GetMetadata ( o) => get_metadata ( o) . await ,
7593 Opt :: GetBlob ( o) => get_blob ( o) . await ,
94+ Opt :: FetchContainerToDevNull ( o) => fetch_container_to_devnull ( o) . await ,
7695 }
7796}
7897
You can’t perform that action at this time.
0 commit comments