Skip to content

Commit

Permalink
Update CRT submodules to latest releases (awslabs#633)
Browse files Browse the repository at this point in the history
* Update CRT submodules to latest releases

Signed-off-by: Daniel Carl Jones <[email protected]>

* Add changelog entries

Signed-off-by: Daniel Carl Jones <[email protected]>

* Update aws_s3_request_type bindings

Signed-off-by: Daniel Carl Jones <[email protected]>

* Update based on feedback

Signed-off-by: Daniel Carl Jones <[email protected]>

---------

Signed-off-by: Daniel Carl Jones <[email protected]>
  • Loading branch information
dannycjones authored Nov 28, 2023
1 parent f2860e7 commit c3521f3
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 18 deletions.
5 changes: 4 additions & 1 deletion mountpoint-s3-client/src/s3_crt_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,9 +828,12 @@ fn status_code_to_log_level(status_code: i32) -> tracing::Level {
}

/// Return a string version of a [RequestType] for use in metrics
///
/// TODO: Replace this method with `aws_s3_request_metrics_get_operation_name`,
/// and ensure all requests have an associated operation name.
fn request_type_to_metrics_string(request_type: RequestType) -> &'static str {
match request_type {
RequestType::Default => "Default",
RequestType::Unknown => "Default",
RequestType::HeadObject => "HeadObject",
RequestType::GetObject => "GetObject",
RequestType::ListParts => "ListParts",
Expand Down
4 changes: 4 additions & 0 deletions mountpoint-s3-crt-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased

* Update to latest CRT dependencies

## v0.4.0 (November 21, 2023)

* Update to latest CRT dependencies
Expand Down
2 changes: 1 addition & 1 deletion mountpoint-s3-crt-sys/crt/aws-c-common
2 changes: 1 addition & 1 deletion mountpoint-s3-crt-sys/crt/aws-lc
6 changes: 6 additions & 0 deletions mountpoint-s3-crt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

* Update to latest CRT dependencies
* Default exponential backoff value retries is now 500ms rather than 25ms ([awslabs/aws-c-io#612](https://github.com/awslabs/aws-c-io/pull/612))
* Renamed `s3::RequestType::Default` to `s3::RequestType::Unknown` to match CRT change ([#633](https://github.com/awslabs/mountpoint-s3/pull/633))

## v0.4.0 (November 21, 2023)

* Update to latest CRT dependencies
Expand Down
39 changes: 27 additions & 12 deletions mountpoint-s3-crt/src/s3/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,8 +1007,8 @@ impl Debug for RequestMetrics {
/// multiple requests to various S3 APIs; this type can be used to distinguish them.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RequestType {
/// Same as the original HTTP request passed to [Client::make_meta_request]
Default,
/// When the request type is unknown to the CRT. Operation name may have been attached to non-meta CRT requests.
Unknown,
/// HeadObject: https://docs.aws.amazon.com/AmazonS3/latest/API/API_HeadObject.html
HeadObject,
/// GetObject: https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
Expand All @@ -1029,17 +1029,16 @@ pub enum RequestType {

impl From<aws_s3_request_type> for RequestType {
fn from(value: aws_s3_request_type) -> Self {
use aws_s3_request_type::*;
match value {
AWS_S3_REQUEST_TYPE_DEFAULT => RequestType::Default,
AWS_S3_REQUEST_TYPE_HEAD_OBJECT => RequestType::HeadObject,
AWS_S3_REQUEST_TYPE_GET_OBJECT => RequestType::GetObject,
AWS_S3_REQUEST_TYPE_LIST_PARTS => RequestType::ListParts,
AWS_S3_REQUEST_TYPE_CREATE_MULTIPART_UPLOAD => RequestType::CreateMultipartUpload,
AWS_S3_REQUEST_TYPE_UPLOAD_PART => RequestType::UploadPart,
AWS_S3_REQUEST_TYPE_ABORT_MULTIPART_UPLOAD => RequestType::AbortMultipartUpload,
AWS_S3_REQUEST_TYPE_COMPLETE_MULTIPART_UPLOAD => RequestType::CompleteMultipartUpload,
AWS_S3_REQUEST_TYPE_UPLOAD_PART_COPY => RequestType::UploadPartCopy,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_UNKNOWN => RequestType::Unknown,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_HEAD_OBJECT => RequestType::HeadObject,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_GET_OBJECT => RequestType::GetObject,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_LIST_PARTS => RequestType::ListParts,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_CREATE_MULTIPART_UPLOAD => RequestType::CreateMultipartUpload,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_UPLOAD_PART => RequestType::UploadPart,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_ABORT_MULTIPART_UPLOAD => RequestType::AbortMultipartUpload,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_COMPLETE_MULTIPART_UPLOAD => RequestType::CompleteMultipartUpload,
aws_s3_request_type::AWS_S3_REQUEST_TYPE_UPLOAD_PART_COPY => RequestType::UploadPartCopy,
_ => panic!("unknown request type {:?}", value),
}
}
Expand Down Expand Up @@ -1171,3 +1170,19 @@ impl UploadReviewPart {
Self { size, checksum }
}
}

#[cfg(test)]
mod tests {
use test_case::test_case;

use crate::aws_s3_request_type;
use crate::s3::client::RequestType;

#[test_case(aws_s3_request_type::AWS_S3_REQUEST_TYPE_UNKNOWN, RequestType::Unknown)]
#[test_case(aws_s3_request_type::AWS_S3_REQUEST_TYPE_HEAD_OBJECT, RequestType::HeadObject)]
#[test_case(aws_s3_request_type::AWS_S3_REQUEST_TYPE_GET_OBJECT, RequestType::GetObject)]
fn request_type_from_aws_s3_request_type(c_request_type: aws_s3_request_type, expected_request_type: RequestType) {
// Simple, but was previously broken.
assert_eq!(expected_request_type, RequestType::from(c_request_type));
}
}

0 comments on commit c3521f3

Please sign in to comment.