Xuanwo commented on code in PR #4881:
URL: https://github.com/apache/opendal/pull/4881#discussion_r1674189264
##########
core/src/raw/http_util/header.rs:
##########
@@ -189,6 +190,45 @@ pub fn parse_into_metadata(path: &str, headers:
&HeaderMap) -> Result<Metadata>
Ok(m)
}
+/// parse_metadata will parse http headers(including standards http headers
+/// and user defined metadata header) into Metadata.
+///
+/// # Arguments
+///
+/// * `user_metadata_prefix` is the prefix of user defined metadata key
+///
+/// # Notes
+///
+/// before return the user defined metadata, we'll strip the
user_metadata_prefix from the key
+pub fn parse_metadata(
Review Comment:
Hi, I'd prefer to keep that logic in the service for now. We can extract it
later if we find it's common across different services.
##########
core/src/services/oss/core.rs:
##########
@@ -41,14 +41,15 @@ use serde::Serialize;
use crate::raw::*;
use crate::*;
-mod constants {
+pub mod constants {
pub const X_OSS_SERVER_SIDE_ENCRYPTION: &str =
"x-oss-server-side-encryption";
pub const X_OSS_SERVER_SIDE_ENCRYPTION_KEY_ID: &str =
"x-oss-server-side-encryption-key-id";
pub const RESPONSE_CONTENT_DISPOSITION: &str =
"response-content-disposition";
pub const OSS_QUERY_VERSION_ID: &str = "versionId";
+ pub const USER_METADATA_PREFIX: &str = "x-oss-meta-";
Review Comment:
How about keeping the same naming style like `X_OSS_META_PREFIX`
##########
core/src/types/operator/operator_futures.rs:
##########
@@ -384,6 +395,16 @@ impl<F: Future<Output = Result<Writer>>> FutureWriter<F> {
pub fn executor(self, executor: Executor) -> Self {
self.map(|(args, options)| (args.with_executor(executor), options))
}
+
+ /// Set the user defined metadata of the op
+ ///
+ /// ## Notes
+ ///
+ /// we don't need to include the user defined metadata prefix in the key
+ /// every service will handle it internally
+ pub fn user_metadata(self, data: HashMap<String, String>) -> Self {
Review Comment:
Let's accept an `FromIterator` to make it easier to use.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]