-
Notifications
You must be signed in to change notification settings - Fork 824
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 Attributes API (#5329) #5650
Conversation
use std::ops::Deref; | ||
|
||
/// Additional object attribute types | ||
#[non_exhaustive] |
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.
This should allow us to add new attributes without it being a breaking change
@@ -363,8 +362,21 @@ impl S3Client { | |||
) | |||
} | |||
|
|||
if let Some(value) = self.config.client_options.get_content_type(path) { | |||
builder = builder.header(CONTENT_TYPE, value); | |||
let mut has_content_type = false; |
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 tried very hard to avoid this getting duplicated in the various implementations, however, it became very hard to devise something that would:
- Allow GCP to always specify a content type
- Generalize to when we support further attributes that will likely diverge across the implementations (e.g. Support User-Defined Object Metadata #4754)
|
||
/// Additional object attribute types | ||
#[non_exhaustive] | ||
#[derive(Debug, Hash, Eq, PartialEq, Clone)] |
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.
This explicitly isn't Copy
to support user defined metadata in future, which will need to have a Metadata(AttributeValue)
variant or similar
|
||
/// The value of an [`Attribute`] | ||
/// | ||
/// Provides efficient conversion from both static and owned strings |
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.
Given how frequently the values will be static strings, I felt it worth the complexity to optimise explicitly for this
/// Unlike [`ObjectMeta`](crate::ObjectMeta), [`Attributes`] are not returned by | ||
/// listing APIs | ||
#[derive(Debug, Default, Eq, PartialEq, Clone)] | ||
pub struct Attributes(HashMap<Attribute, AttributeValue>); |
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 debated making this an Arc
wrapped data structure and then having an AttributesMut
version, however, I decided this wasn't really worth it given that most use-cases will be constructing this per-request anyway (that is kind of the point).
Interestingly the emulators seem to not like this, I will investigate further tomorrow |
Which issue does this PR close?
Closes #5329
Closes #5329
Closes #4498
Rationale for this change
See tickets
This will provide the base that can later be extended to support object metadata #4754
What changes are included in this PR?
Are there any user-facing changes?