Add Attributes API (#5329)#5650
Conversation
| use std::ops::Deref; | ||
|
|
||
| /// Additional object attribute types | ||
| #[non_exhaustive] |
There was a problem hiding this comment.
This should allow us to add new attributes without it being a breaking change
|
|
||
| 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.
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. #4754)
|
|
||
| /// Additional object attribute types | ||
| #[non_exhaustive] | ||
| #[derive(Debug, Hash, Eq, PartialEq, Clone)] |
There was a problem hiding this comment.
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.
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.
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 |
* Add Attributes API (#5329) * Clippy * Emulator test tweaks
Which issue does this PR close?
Closes apache/arrow-rs-object-store#95
Closes apache/arrow-rs-object-store#95
Closes #4498
Rationale for this change
See tickets
This will provide the base that can later be extended to support object metadata apache/arrow-rs-object-store#145
What changes are included in this PR?
Are there any user-facing changes?