Emit a `Pulled` platform event with progress metadata for the CLI.
(&self, sandbox_id: &str, image_ref: &str, image_path: &Path)
| 3597 | |
| 3598 | /// Emit a `Pulled` platform event with progress metadata for the CLI. |
| 3599 | async fn publish_pulled_event(&self, sandbox_id: &str, image_ref: &str, image_path: &Path) { |
| 3600 | let mut metadata = HashMap::from([("image_ref".to_string(), image_ref.to_string())]); |
| 3601 | let size_suffix = tokio::fs::metadata(image_path).await.map_or_else( |
| 3602 | |_| String::new(), |
| 3603 | |meta| { |
| 3604 | metadata.insert("image_size_bytes".to_string(), meta.len().to_string()); |
| 3605 | format!(" Image size: {} bytes.", meta.len()) |
| 3606 | }, |
| 3607 | ); |
| 3608 | self.publish_vm_progress( |
| 3609 | sandbox_id, |
| 3610 | "Pulled", |
| 3611 | format!("Successfully pulled image \"{image_ref}\".{size_suffix}"), |
| 3612 | metadata, |
| 3613 | ); |
| 3614 | } |
| 3615 | } |
| 3616 | |
| 3617 | struct DownloadedRegistryLayer { |
no test coverage detected