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

Method DeleteDirContents

cpp/src/arrow/filesystem/mockfs.cc:504–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502}
503
504Status MockFileSystem::DeleteDirContents(const std::string& path, bool missing_dir_ok) {
505 RETURN_NOT_OK(ValidatePath(path));
506 auto parts = SplitAbstractPath(path);
507 RETURN_NOT_OK(ValidateAbstractPathParts(parts));
508
509 auto guard = impl_->lock_guard();
510
511 if (parts.empty()) {
512 // Wipe filesystem
513 return internal::InvalidDeleteDirContents(path);
514 }
515
516 Entry* entry = impl_->FindEntry(parts);
517 if (entry == nullptr) {
518 if (missing_dir_ok) {
519 return Status::OK();
520 }
521 return PathNotFound(path);
522 }
523 if (!entry->is_dir()) {
524 return NotADir(path);
525 }
526 entry->as_dir().entries.clear();
527 return Status::OK();
528}
529
530Status MockFileSystem::DeleteRootDirContents() {
531 auto guard = impl_->lock_guard();

Callers

nothing calls this directly

Calls 12

SplitAbstractPathFunction · 0.85
InvalidDeleteDirContentsFunction · 0.85
lock_guardMethod · 0.80
FindEntryMethod · 0.80
is_dirMethod · 0.80
ValidatePathFunction · 0.70
PathNotFoundFunction · 0.70
NotADirFunction · 0.70
OKFunction · 0.50
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected