Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CRT submodules to latest releases #633

Merged
merged 4 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
5 changes: 5 additions & 0 deletions mountpoint-s3-crt-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 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))
dannycjones marked this conversation as resolved.
Show resolved Hide resolved

## 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`

## 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));
}
}
Loading