Skip to content

Commit

Permalink
Only enable if requested
Browse files Browse the repository at this point in the history
  • Loading branch information
avantgardnerio committed Dec 4, 2024
1 parent 6757413 commit 8a3fd4e
Showing 1 changed file with 3 additions and 28 deletions.
31 changes: 3 additions & 28 deletions object_store/src/aws/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl From<DeleteError> for Error {
}
}

#[derive(Debug, Clone)]
#[derive(Debug)]
pub(crate) struct S3Config {
pub region: String,
pub endpoint: Option<String>,
Expand Down Expand Up @@ -462,27 +462,6 @@ impl S3Client {
}
}

#[allow(dead_code)]
pub(crate) fn request_with_config<'a>(
&'a self,
method: Method,
path: &'a Path,
config: &'a S3Config,
) -> Request<'a> {
let url = self.config.path_url(path);
Request {
path,
builder: self.client.request(method, url),
payload: None,
payload_sha256: None,
config,
use_session_creds: true,
idempotent: false,
retry_on_conflict: false,
retry_error_body: false,
}
}

/// Make an S3 Delete Objects request <https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html>
///
/// Produces a vector of results, one for each path in the input vector. If
Expand Down Expand Up @@ -640,7 +619,7 @@ impl S3Client {
checksum: bool,
) -> Result<MultipartId> {
let mut req = self.request(Method::POST, location);
if checksum {
if self.config.checksum == Some(Checksum::SHA256) && checksum {
req = req.header("x-amz-checksum-algorithm", "SHA256");
}
let response = req
Expand Down Expand Up @@ -670,13 +649,9 @@ impl S3Client {
) -> Result<PartId> {
let is_copy = matches!(data, PutPartPayload::Copy(_));
let part = (part_idx + 1).to_string();
let config = S3Config {
checksum: Some(Checksum::SHA256),
..self.config.clone()
};

let mut request = self
.request_with_config(Method::PUT, path, &config)
.request(Method::PUT, path)
.query(&[("partNumber", &part), ("uploadId", upload_id)])
.idempotent(true);

Expand Down

0 comments on commit 8a3fd4e

Please sign in to comment.