Skip to content

Commit

Permalink
feat: Add option for using monolithic push
Browse files Browse the repository at this point in the history
Signed-off-by: Joonas Bergius <[email protected]>
  • Loading branch information
joonas committed Oct 22, 2024
1 parent abba4b5 commit 30c0b71
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,10 @@ impl Client {
data: &[u8],
digest: &str,
) -> Result<String> {
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)) => {
Expand Down Expand Up @@ -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<Certificate>,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 30c0b71

Please sign in to comment.