From da485da007bb34ff2689a28d7ada07dded444fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Wed, 27 Mar 2024 19:17:48 +0100 Subject: [PATCH] Add zstd:chunked support Fixes: https://github.com/ostreedev/ostree-rs-ext/issues/608 --- lib/Cargo.toml | 2 +- lib/src/container/unencapsulate.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Cargo.toml b/lib/Cargo.toml index a9a2d829..ef6f5e42 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -12,7 +12,7 @@ rust-version = "1.74.0" [dependencies] anyhow = "1.0" containers-image-proxy = "0.5.5" -async-compression = { version = "0.4", features = ["gzip", "tokio"] } +async-compression = { version = "0.4", features = ["gzip", "tokio", "zstd"] } camino = "1.0.4" chrono = "0.4.19" olpc-cjson = "0.1.1" diff --git a/lib/src/container/unencapsulate.rs b/lib/src/container/unencapsulate.rs index 11f56c0f..b6efb8d8 100644 --- a/lib/src/container/unencapsulate.rs +++ b/lib/src/container/unencapsulate.rs @@ -198,6 +198,9 @@ fn new_async_decompressor<'a>( oci_image::MediaType::ImageLayerGzip => Ok(Box::new(tokio::io::BufReader::new( async_compression::tokio::bufread::GzipDecoder::new(src), ))), + oci_image::MediaType::ImageLayerZstd => Ok(Box::new(tokio::io::BufReader::new( + async_compression::tokio::bufread::ZstdDecoder::new(src), + ))), oci_image::MediaType::ImageLayer => Ok(Box::new(src)), oci_image::MediaType::Other(t) if t.as_str() == DOCKER_TYPE_LAYER_TAR => Ok(Box::new(src)), o => Err(anyhow::anyhow!("Unhandled layer type: {}", o)),