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

Add ability to request checksum in an S3 HeadObject request #1083

Merged
merged 5 commits into from
Oct 28, 2024

Conversation

dannycjones
Copy link
Contributor

Description of change

For a consumer of the S3 client, we need to return the checksum algorithm used with the object. This change adds the request option to retrieve checksum algorithm as part of a HeadObject request. The result now include the field, which will only be populated when requested and supported by the S3 implementation.

Relevant issues: N/A

Does this change impact existing behavior?

We now require a HeadObjectParams struct when invoking head_object with the S3 client. This changes the signature, and so a change log entry will be added for the client crate. There is no behavior change.

Does this change need a changelog entry in any of the crates?

Yes, a note is added for mountpoint-s3-client crate.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and I agree to the terms of the Developer Certificate of Origin (DCO).

Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
@@ -647,7 +682,7 @@ impl fmt::Display for ObjectAttribute {
///
/// See [Checksum](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Checksum.html) in the *Amazon
/// S3 API Reference* for more details.
#[derive(Debug)]
#[derive(Clone, Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on having the checksums typed once #1082 goes in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion. I'd be inclined to stick close to the REST API but I see we already diverged a bit by creating a Checksum struct in the first place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this a bit more:

  • Probably HeadObject shouldn't be returning this struct, but instead each checksum on the HeadObjectResult. (This struct is mirroring how GetObjectAttributes returns the values.)
  • We could have Option<Crc32>, etc. here. That sounds fine to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are talking about whether to wrap the Optional checksums in a Checksum struct, my slight preference is in favour - I don't think its really diverging from the API in meaningful ways. But I don't think it's really too interesting either way.

I care a bit more about the "typed" checksums. As I sees it we should either:

  1. keep everything as String, neutral and close to the API. We'll offer separate facilities to parse checksums (and encode as base64).
  2. consistently use our checksum types.

My preference is for (2), which seems much nicer for users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of this is blocking for this PR, just bringing it up because we may want to go through all related API changes in one release cycle.

Signed-off-by: Daniel Carl Jones <djonesoa@amazon.com>
Copy link
Contributor

@passaro passaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. See comments on API changes, but happy to review in a separate PR.

@dannycjones
Copy link
Contributor Author

Looks good. See comments on API changes, but happy to review in a separate PR.

I'll merge now, let's converge on an approach with the API changes in new PR if needed.

@dannycjones dannycjones added this pull request to the merge queue Oct 28, 2024
Merged via the queue into awslabs:main with commit 8f2770b Oct 28, 2024
23 checks passed
@dannycjones dannycjones deleted the headobject-return-checksum branch October 28, 2024 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants