-
Notifications
You must be signed in to change notification settings - Fork 689
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 user defined metadata #5915
Changes from 6 commits
33ca8a6
e75e486
7825d61
fc17928
7d39dfb
f7bb58b
da24f88
8d19c44
6b1030e
8f9d04f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ use std::sync::Arc; | |
|
||
const VERSION_HEADER: &str = "x-amz-version-id"; | ||
const SHA256_CHECKSUM: &str = "x-amz-checksum-sha256"; | ||
const USER_DEFINED_METADATA_HEADER_PREFIX: &str = "x-amz-meta-"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Happy to rename to whatever. I chose to be quite verbose because I feel there's a lot of confusion about "metadata". You can see this play out in #4754, where the conversation muddles user-defined metadata and tags. Add in standard (non-user-defined) metadata and it gets even more murky. Y'all let me know what to rename to, though. :) |
||
|
||
/// A specialized `Error` for object store-related errors | ||
#[derive(Debug, Snafu)] | ||
|
@@ -326,6 +327,10 @@ impl<'a> Request<'a> { | |
has_content_type = true; | ||
builder.header(CONTENT_TYPE, v.as_ref()) | ||
} | ||
Attribute::Metadata(k_suffix) => builder.header( | ||
&format!("{}{}", USER_DEFINED_METADATA_HEADER_PREFIX, k_suffix), | ||
criccomini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
v.as_ref(), | ||
), | ||
}; | ||
} | ||
|
||
|
@@ -642,6 +647,7 @@ impl GetClient for S3Client { | |
etag_required: false, | ||
last_modified_required: false, | ||
version_header: Some(VERSION_HEADER), | ||
user_defined_metadata_prefix: Some(USER_DEFINED_METADATA_HEADER_PREFIX), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: how about using |
||
}; | ||
|
||
/// Make an S3 GET request <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,6 +183,8 @@ impl Client { | |
has_content_type = true; | ||
builder.header(CONTENT_TYPE, v.as_ref()) | ||
} | ||
// Ignore metadata attributes | ||
Attribute::Metadata(_) => builder, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WebDAV handles custom metadata in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the meantime I think we should return an error as per https://docs.rs/object_store/latest/object_store/struct.PutOptions.html#structfield.attributes |
||
}; | ||
} | ||
|
||
|
@@ -319,6 +321,7 @@ impl GetClient for Client { | |
etag_required: false, | ||
last_modified_required: false, | ||
version_header: None, | ||
user_defined_metadata_prefix: None, | ||
}; | ||
|
||
async fn get_request(&self, path: &Path, options: GetOptions) -> Result<Response> { | ||
|
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.
It's likely a silliness that will make no measurable performance difference, but given these will often be static strings, I wonder what you think of making this
Cow<'static, str>