Skip to content

Commit 0ab9182

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 95e4f84 commit 0ab9182

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

crates/cfsctl/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ path = "src/lib.rs"
1616
[features]
1717
default = ['pre-6.15', 'oci']
1818
http = ['composefs-http']
19-
oci = ['composefs-oci']
19+
oci = ['composefs-oci', 'splitfdstream']
2020
rhel9 = ['composefs/rhel9']
2121
'pre-6.15' = ['composefs/pre-6.15']
2222

@@ -29,6 +29,7 @@ composefs = { workspace = true }
2929
composefs-boot = { workspace = true }
3030
composefs-oci = { workspace = true, optional = true, features = ["boot"] }
3131
composefs-http = { workspace = true, optional = true }
32+
splitfdstream = { workspace = true, optional = true }
3233
env_logger = { version = "0.11.0", default-features = false }
3334
hex = { version = "0.4.0", default-features = false }
3435
rustix = { version = "1.0.0", default-features = false, features = ["fs", "process"] }

crates/cfsctl/src/lib.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,16 @@ enum OciCommand {
199199
/// Optional human-readable name for the layer
200200
name: Option<String>,
201201
},
202+
/// Imports a complete image from a splitfdstream server into the repository.
203+
ImportImageSplitfdstream {
204+
/// Path to the splitfdstream server socket
205+
socket: PathBuf,
206+
/// The image ID (manifest digest or tag)
207+
image_id: String,
208+
/// Tag name for imported image
209+
#[clap(long)]
210+
tag: Option<String>,
211+
},
202212
/// List the contents of a stored tar layer
203213
LsLayer {
204214
/// Layer content digest, e.g. sha256:a1b2c3...
@@ -810,6 +820,27 @@ where
810820
.await?;
811821
println!("{}", object_id.to_id());
812822
}
823+
OciCommand::ImportImageSplitfdstream {
824+
socket,
825+
image_id,
826+
tag,
827+
} => {
828+
let result = composefs_oci::import_complete_image_from_splitfdstream(
829+
&Arc::new(repo),
830+
&socket,
831+
&image_id,
832+
tag.as_deref(),
833+
)?;
834+
835+
println!("Imported complete image:");
836+
println!(" Manifest: {}", result.manifest_digest);
837+
println!(" Config: {}", result.config_digest);
838+
println!(" Layers: {}", result.layers_imported);
839+
println!(" Size: {} bytes", result.total_size_bytes);
840+
if let Some(tag_name) = tag {
841+
println!(" Tagged: {}", tag_name);
842+
}
843+
}
813844
OciCommand::LsLayer { ref name } => {
814845
composefs_oci::ls_layer(&repo, name)?;
815846
}

0 commit comments

Comments
 (0)