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

Method DeleteDirContentsAsync

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

Source from the content-addressed store, hash-verified

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