MCPcopy Create free account
hub / github.com/apache/arrow / DeleteDirContentsAsync

Method DeleteDirContentsAsync

cpp/src/arrow/filesystem/s3fs.cc:3346–3365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3344}
3345
3346Future<> S3FileSystem::DeleteDirContentsAsync(const std::string& s, bool missing_dir_ok) {
3347 ARROW_ASSIGN_OR_RAISE(auto path, S3Path::FromString(s));
3348
3349 if (path.empty()) {
3350 return Status::NotImplemented("Cannot delete all S3 buckets");
3351 }
3352 auto self = impl_;
3353 return impl_->DeleteDirContentsAsync(path.bucket, path.key)
3354 .Then(
3355 [path, self]() {
3356 // Directory may be implicitly deleted, recreate it
3357 return self->EnsureDirectoryExists(path);
3358 },
3359 [missing_dir_ok](const Status& err) {
3360 if (missing_dir_ok && ::arrow::internal::ErrnoFromStatus(err) == ENOENT) {
3361 return Status::OK();
3362 }
3363 return err;
3364 });
3365}
3366
3367Status S3FileSystem::DeleteRootDirContents() {
3368 return Status::NotImplemented("Cannot delete all S3 buckets");

Callers 3

PrepareDirectoryMethod · 0.45
TEST_FFunction · 0.45
DeleteDirMethod · 0.45

Calls 6

ThenMethod · 0.80
EnsureDirectoryExistsMethod · 0.80
ErrnoFromStatusFunction · 0.70
NotImplementedFunction · 0.50
OKFunction · 0.50
emptyMethod · 0.45

Tested by 1

TEST_FFunction · 0.36