coryan commented on a change in pull request #11890:
URL: https://github.com/apache/arrow/pull/11890#discussion_r766013830



##########
File path: cpp/src/arrow/filesystem/gcsfs.cc
##########
@@ -342,6 +344,53 @@ class GcsFileSystem::Impl {
     return internal::ToArrowStatus(CreateDirMarkerRecursive(p.bucket, 
p.object));
   }
 
+  Status DeleteDir(const GcsPath& p, const io::IOContext& io_context) {
+    RETURN_NOT_OK(DeleteDirContents(p, io_context));
+    if (!p.object.empty()) {
+      return internal::ToArrowStatus(client_.DeleteObject(p.bucket, p.object));
+    }
+    return internal::ToArrowStatus(client_.DeleteBucket(p.bucket));
+  }
+
+  Status DeleteDirContents(const GcsPath& p, const io::IOContext& io_context) {
+    // Deleting large directories can be fairly slow, we need to parallelize 
the
+    // operation. This uses `std::async()` to run multiple delete operations 
in parallel.
+    // A simple form of flow control limits the number of operations running in
+    // parallel.
+
+    auto async_delete =
+        [&p](gcs::Client& client,
+             google::cloud::StatusOr<gcs::ObjectMetadata> o) -> 
google::cloud::Status {

Review comment:
       Done.  I captured `this` because capturing `client_` is not possible in 
C++11.




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