Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(core/services-azblob): support user defined metadata #5274
feat(core/services-azblob): support user defined metadata #5274
Changes from all commits
23bb518
f645cc6
4c6476a
398efed
39e4d62
72e6e10
155bb1a
1927932
4282d5d
d28eae6
4d6057b
3228bd2
d76c46d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 check is also done in the s3 backend.
Should we always call
meta.with_user_metadata(user_meta);
instead of checking if theuser_meta
is empty?Or can we for example, add that checking inside
meta.with_user_metadata(user_meta);
and do an early return if theuser_meta
hashmap is empty?opendal/core/src/types/metadata.rs
Line 524 in 1927932
I find that checking in each backend if the hashmap is empty is error-prone boilerplate...
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 fine to have such a check. OpenDAL tends to have more readable code because we have many services, and that code is rarely modified.
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'm setting the metadata headers only for the
azblob_put_blob_request
.Should this also be done for
block
requests, for example, inazblob_put_block_request
? Or the metadata will be only supported forblobs
?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 see that in
OSS
the metadata headers is also set for theappend_object_request
. Should the azure append blob requests also send these headers?azblob_append_blob_request
,azblob_init_appendable_blob_request
, etc..?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.
Not sure for now; I will need some time to delve into the documentation.
I remember that only the first append request can include user metadata, but I'm not sure about that. Feel free to do more research on this.
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.
In the
azblob
ands3
services, this code is done in thebackend
moduleopendal/core/src/services/azblob/backend.rs
Line 552 in 4d6057b
But in the
oss
it is done in thisparse_metadata
function in thecore
module and called from thebackend
moduleopendal/core/src/services/oss/backend.rs
Line 492 in 4d6057b
I think we should unify this in order to be consistent.
In my opinion, maybe we can create a new
pub fn parse_prefixed_metadata(path:&str, headers: &HeaderMap, prefix: &str)
in thecrate::raw::http_util::header
module that contains the code from thisparse_metadata
funtion, and then call thatparse_prefixed_metadata
in thebackend
module of those three servicesWhat do you think?
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.
Hi, it's better not to do this since every service has its own functions. You'll see if you delve into the implementation of different services.
The
parse_metadata
provided byraw::http
will only parse the HTTP standards. Services may implement their own logic to meet their specific needs.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.
Changed this in order to be consistent with what I did in the azure part. It is more idiomatic to use string interpolation