File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ struct GetBlobOpts {
29
29
enum Opt {
30
30
GetMetadata ( GetMetadataOpts ) ,
31
31
GetBlob ( GetBlobOpts ) ,
32
+ FetchContainerToDevNull ( GetMetadataOpts ) ,
32
33
}
33
34
34
35
#[ derive( serde:: Serialize , Debug ) ]
@@ -69,10 +70,28 @@ async fn get_blob(o: GetBlobOpts) -> Result<()> {
69
70
Ok ( ( ) )
70
71
}
71
72
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
+
72
90
async fn run ( ) -> Result < ( ) > {
73
91
match Opt :: parse ( ) {
74
92
Opt :: GetMetadata ( o) => get_metadata ( o) . await ,
75
93
Opt :: GetBlob ( o) => get_blob ( o) . await ,
94
+ Opt :: FetchContainerToDevNull ( o) => fetch_container_to_devnull ( o) . await ,
76
95
}
77
96
}
78
97
You can’t perform that action at this time.
0 commit comments