Skip to content

Commit d3efe7e

Browse files
committed
cfsctl: add import-image-splitfdstream command
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
1 parent f679965 commit d3efe7e

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

crates/composefs-ctl/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ path = "src/main.rs"
1919
[features]
2020
default = ['pre-6.15', 'oci', 'containers-storage']
2121
http = ['composefs-http']
22-
oci = ['composefs-oci', 'composefs-oci/varlink']
22+
oci = ['composefs-oci', 'composefs-oci/varlink', 'splitfdstream']
2323
containers-storage = ['composefs-oci/containers-storage', 'cstorage']
2424
rhel9 = ['composefs/rhel9']
2525
'pre-6.15' = ['composefs/pre-6.15']
@@ -34,6 +34,7 @@ composefs-boot = { workspace = true }
3434
composefs-oci = { workspace = true, optional = true, features = ["boot"] }
3535
composefs-http = { workspace = true, optional = true }
3636
cstorage = { package = "composefs-storage", path = "../composefs-storage", version = "0.4.0", features = ["userns-helper"], optional = true }
37+
splitfdstream = { workspace = true, optional = true }
3738
env_logger = { version = "0.11.0", default-features = false }
3839
hex = { version = "0.4.0", default-features = false }
3940
indicatif = { version = "0.17.0", default-features = false }

crates/composefs-ctl/src/lib.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,16 @@ enum OciCommand {
348348
/// Optional human-readable name for the layer
349349
name: Option<String>,
350350
},
351+
/// Imports a complete image from a splitfdstream server into the repository.
352+
ImportImageSplitfdstream {
353+
/// Path to the splitfdstream server socket
354+
socket: PathBuf,
355+
/// The image ID (manifest digest or tag)
356+
image_id: String,
357+
/// Tag name for imported image
358+
#[clap(long)]
359+
tag: Option<String>,
360+
},
351361
/// Dump the rootfs of a stored OCI image as a composefs dumpfile to stdout
352362
///
353363
/// The image can be specified by ref name or @digest:
@@ -1209,6 +1219,27 @@ where
12091219
.await?;
12101220
println!("{}", object_id.to_id());
12111221
}
1222+
OciCommand::ImportImageSplitfdstream {
1223+
socket,
1224+
image_id,
1225+
tag,
1226+
} => {
1227+
let result = composefs_oci::import_complete_image_from_splitfdstream(
1228+
&repo,
1229+
&socket,
1230+
&image_id,
1231+
tag.as_deref(),
1232+
)?;
1233+
1234+
println!("Imported complete image:");
1235+
println!(" Manifest: {}", result.manifest_digest);
1236+
println!(" Config: {}", result.config_digest);
1237+
println!(" Layers: {}", result.layers_imported);
1238+
println!(" Size: {} bytes", result.total_size_bytes);
1239+
if let Some(tag_name) = tag {
1240+
println!(" Tagged: {}", tag_name);
1241+
}
1242+
}
12121243
OciCommand::Dump { config_opts } => {
12131244
let fs = load_filesystem_from_oci_image(&repo, config_opts)?;
12141245
fs.print_dumpfile()?;

0 commit comments

Comments
 (0)