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

Function pull_from_prepared

crates/lib/src/deploy.rs:699–770  ·  view source on GitHub ↗
(
    imgref: &ImageReference,
    quiet: bool,
    prog: ProgressWriter,
    mut prepared_image: PreparedImportMeta,
)

Source from the content-addressed store, hash-verified

697
698#[context("Pulling")]
699pub(crate) async fn pull_from_prepared(
700 imgref: &ImageReference,
701 quiet: bool,
702 prog: ProgressWriter,
703 mut prepared_image: PreparedImportMeta,
704) -> Result<Box<ImageState>> {
705 let layer_progress = prepared_image.imp.request_progress();
706 let layer_byte_progress = prepared_image.imp.request_layer_progress();
707 let digest = prepared_image.digest.clone();
708 let digest_imp = prepared_image.digest.clone();
709
710 let printer = tokio::task::spawn(async move {
711 handle_layer_progress_print(LayerProgressConfig {
712 layers: layer_progress,
713 layer_bytes: layer_byte_progress,
714 digest: digest.as_ref().into(),
715 n_layers_to_fetch: prepared_image.n_layers_to_fetch,
716 layers_total: prepared_image.layers_total,
717 bytes_to_download: prepared_image.bytes_to_fetch,
718 bytes_total: prepared_image.bytes_total,
719 prog,
720 quiet,
721 })
722 .await
723 });
724 let import = prepared_image.imp.import(prepared_image.prep).await;
725 let prog = printer.await?;
726 // Both the progress and the import are done, so import is done as well
727 prog.send(Event::ProgressSteps {
728 task: "importing".into(),
729 description: "Importing Image".into(),
730 id: digest_imp.clone().as_ref().into(),
731 steps_cached: 0,
732 steps: 1,
733 steps_total: 1,
734 subtasks: [SubTaskStep {
735 subtask: "importing".into(),
736 description: "Importing Image".into(),
737 id: "importing".into(),
738 completed: true,
739 }]
740 .into(),
741 })
742 .await;
743 let import = import?;
744 let imgref_canonicalized = imgref.clone().canonicalize()?;
745 tracing::debug!("Canonicalized image reference: {imgref_canonicalized:#}");
746
747 // Log successful import completion (skip if using unified storage to avoid double logging)
748 let is_unified_path = imgref.transport == "containers-storage";
749 if !is_unified_path {
750 const IMPORT_COMPLETE_JOURNAL_ID: &str = "4d3e2f1a0b9c8d7e6f5a4b3c2d1e0f9a8";
751
752 tracing::info!(
753 message_id = IMPORT_COMPLETE_JOURNAL_ID,
754 bootc.image.reference = &imgref.image,
755 bootc.image.transport = &imgref.transport,
756 bootc.manifest_digest = import.manifest_digest.as_ref(),

Callers 3

install_containerFunction · 0.85
pull_unifiedFunction · 0.85
pullFunction · 0.85

Calls 10

spawnFunction · 0.85
request_progressMethod · 0.80
importMethod · 0.80
sendMethod · 0.80
intoMethod · 0.45
as_refMethod · 0.45
canonicalizeMethod · 0.45

Tested by

no test coverage detected