MCPcopy Create free account
hub / github.com/bootc-dev/bootc / pull

Method pull

crates/lib/src/podstorage.rs:426–444  ·  view source on GitHub ↗

Fetch the image if it is not already present; return whether or not the image was fetched.

(&self, image: &str, mode: PullMode)

Source from the content-addressed store, hash-verified

424 /// Fetch the image if it is not already present; return whether
425 /// or not the image was fetched.
426 pub(crate) async fn pull(&self, image: &str, mode: PullMode) -> Result<bool> {
427 match mode {
428 PullMode::IfNotExists => {
429 if self.exists(image).await? {
430 tracing::debug!("Image is already present: {image}");
431 return Ok(false);
432 }
433 }
434 PullMode::Always => {}
435 };
436 let mut cmd = self.new_image_cmd()?;
437 cmd.stdin(Stdio::null());
438 cmd.stdout(Stdio::null());
439 cmd.args(["pull", image]);
440 tracing::debug!("Pulling image: {image}");
441 let mut cmd = AsyncCommand::from(cmd);
442 cmd.run().await.context("Failed to pull image")?;
443 Ok(true)
444 }
445
446 /// Copy an image from the default container storage (/var/lib/containers/)
447 /// to this storage.

Callers 2

set_unifiedFunction · 0.80
pull_images_implFunction · 0.80

Calls 4

existsMethod · 0.80
new_image_cmdMethod · 0.80
argsMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected