You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2023/04/27 13:40:33 UTC

[GitHub] [incubator-opendal] Xuanwo commented on a diff in pull request #2142: feat(services/gcs): support batch delete for gcs

Xuanwo commented on code in PR #2142:
URL: https://github.com/apache/incubator-opendal/pull/2142#discussion_r1179175045


##########
core/src/services/gcs/core.rs:
##########
@@ -250,6 +250,48 @@ impl GcsCore {
         self.send(req).await
     }
 
+    pub async fn gcs_delete_objects(
+        &self,
+        paths: Vec<String>,
+    ) -> Result<Response<IncomingAsyncBody>> {
+        let uri = "/batch/storage/v1/".to_string();
+        let mut req = Request::post(&uri);
+        req = req.header(
+            CONTENT_TYPE,
+            "multipart/mixed; boundary==\"---opendal-gcs-batch-delete-boundary---\"",
+        );
+
+        let mut batch_req_body = BytesMut::default();
+
+        for path in paths {
+            let p = build_abs_path(&self.root, &path);
+            let mut req_body = BytesMut::default();
+            write!(
+                &mut req_body,
+                "--\"---opendal-gcs-batch-delete-boundary---\"\n
+                Content-Type: application/http\n\n
+                DELETE {}/batch/storage/v1/b/{}/o/{}\n

Review Comment:
   If this url correct?



##########
core/src/services/gcs/backend.rs:
##########
@@ -501,6 +503,52 @@ impl Accessor for GcsBackend {
             GcsPager::new(self.core.clone(), path, "", args.limit()),
         ))
     }
+    async fn batch(&self, args: OpBatch) -> Result<RpBatch> {
+        let ops = args.into_operation();
+        if ops.len() > 99 {

Review Comment:
   This should be `> 100`?



-- 
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