You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "suyanhanx (via GitHub)" <gi...@apache.org> on 2023/05/22 09:06:05 UTC

[GitHub] [incubator-opendal] suyanhanx commented on a diff in pull request #2279: feat(services/oss): add append support

suyanhanx commented on code in PR #2279:
URL: https://github.com/apache/incubator-opendal/pull/2279#discussion_r1200219626


##########
core/src/services/oss/core.rs:
##########
@@ -186,6 +187,53 @@ impl OssCore {
         Ok(req)
     }
 
+    /// Oss append object request
+    ///
+    /// # Note
+    ///
+    /// This request is used to append data to an existing object or create an appendable object.
+    /// So you must set the `append` and `position` header.
+    ///
+    /// https://www.alibabacloud.com/help/object-storage-service/latest/appendobject
+    pub fn oss_append_object_request(
+        &self,
+        path: &str,
+        position: u64,
+        size: usize,
+        args: &OpAppend,
+        body: AsyncBody,
+    ) -> Result<Request<AsyncBody>> {
+        let p = build_abs_path(&self.root, path);
+        let endpoint = self.get_endpoint(false);
+        let url = format!("{}/{}", endpoint, percent_encode_path(&p));
+
+        let mut req = Request::post(&url);
+
+        // The header `append` does not need a value.
+        req = req.header(HeaderName::from_static("append"), "");
+        req = req.header(HeaderName::from_static("position"), position);

Review Comment:
   ![image](https://github.com/apache/incubator-opendal/assets/24221472/433ea42b-a9db-4920-b386-8351f354f3d3)
   
   Seems they are headers?
   
   https://www.alibabacloud.com/help/en/object-storage-service/latest/appendobject



-- 
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: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org