-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add ability to request checksum in an S3 HeadObject request #1083
Conversation
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)] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 Option
al 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:
- keep everything as
String
, neutral and close to the API. We'll offer separate facilities to parse checksums (and encode as base64). - consistently use our checksum types.
My preference is for (2), which seems much nicer for users.
There was a problem hiding this comment.
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>
There was a problem hiding this 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.
I'll merge now, let's converge on an approach with the API changes in new PR if needed. |
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 invokinghead_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).