Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ tracing = "0.1"

[lib]
path = "src/imageproxy.rs"

[features]
# See https://github.com/containers/skopeo/blob/03da797e42374892bca8759668adb0b06d087876/cmd/skopeo/proxy.go#L95
proxy_v0_2_4 = []
14 changes: 14 additions & 0 deletions src/imageproxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,20 @@ impl ImageProxy {
Ok(OpenedImage(imgid))
}

#[instrument]
#[cfg(feature = "proxy_v0_2_4")]
pub async fn open_image_optional(&self, imgref: &str) -> Result<Option<OpenedImage>> {
tracing::debug!("opening image");
let (imgid, _) = self
.impl_request::<u32, _, _>("OpenImageOptional", [imgref])
.await?;
if imgid == 0 {
Ok(None)
} else {
Ok(Some(OpenedImage(imgid)))
}
}

#[instrument]
pub async fn close_image(&self, img: &OpenedImage) -> Result<()> {
tracing::debug!("closing image");
Expand Down