From 30c0b71e774803a5ecf1afccce705c9a3ecc246a Mon Sep 17 00:00:00 2001 From: Joonas Bergius Date: Sun, 13 Oct 2024 17:33:56 -0500 Subject: [PATCH] feat: Add option for using monolithic push Signed-off-by: Joonas Bergius --- src/client.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/client.rs b/src/client.rs index 5c79d5fc..767a7c13 100644 --- a/src/client.rs +++ b/src/client.rs @@ -559,6 +559,10 @@ impl Client { data: &[u8], digest: &str, ) -> Result { + if self.config.use_monolithic_push { + return self.push_blob_monolithically(image_ref, data, digest).await; + } + match self.push_blob_chunked(image_ref, data, digest).await { Ok(url) => Ok(url), Err(OciDistributionError::SpecViolationError(violation)) => { @@ -1797,6 +1801,9 @@ pub struct ClientConfig { /// Accept invalid certificates. Defaults to false pub accept_invalid_certificates: bool, + /// Use monolithic push for pushing blobs. Defaults to false + pub use_monolithic_push: bool, + /// A list of extra root certificate to trust. This can be used to connect /// to servers using self-signed certificates pub extra_root_certificates: Vec, @@ -1861,6 +1868,7 @@ impl Default for ClientConfig { #[cfg(feature = "native-tls")] accept_invalid_hostnames: false, accept_invalid_certificates: false, + use_monolithic_push: false, extra_root_certificates: Vec::new(), platform_resolver: Some(Box::new(current_platform_resolver)), max_concurrent_upload: DEFAULT_MAX_CONCURRENT_UPLOAD,