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


##########
core/src/services/dropbox/backend.rs:
##########
@@ -162,6 +166,121 @@ impl Accessor for DropboxBackend {
             _ => Err(parse_error(resp).await?),
         }
     }
+
+    async fn batch(&self, args: OpBatch) -> Result<RpBatch> {
+        let ops = args.into_operation();
+        if ops.len() > 1000 {
+            return Err(Error::new(
+                ErrorKind::Unsupported,
+                "dropbox services only allow delete up to 1000 keys at once",
+            )
+            .with_context("length", ops.len().to_string()));
+        }
+
+        let paths = ops.into_iter().map(|(p, _)| p).collect::<Vec<_>>();
+
+        let resp = self.core.dropbox_delete_batch(paths).await?;
+
+        let status = resp.status();
+
+        match status {
+            StatusCode::OK => {
+                let (_parts, body) = resp.into_parts();
+                let bs = body.bytes().await?;
+                let decoded_response = 
serde_json::from_slice::<DropboxDeleteBatchResponse>(&bs)
+                    .map_err(new_json_deserialize_error)?;
+
+                match decoded_response.tag.as_str() {
+                    "complete" => {
+                        let entries = 
decoded_response.entries.unwrap_or_default();
+                        let results = 
handle_batch_delete_complete_result(entries);
+                        Ok(RpBatch::new(results))
+                    }
+                    "async_job_id" => {
+                        let job_id = decoded_response
+                            .async_job_id
+                            .expect("async_job_id should be present");
+                        loop {

Review Comment:
   Let me take a look.



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

Reply via email to