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

Method CreateFile

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

Source from the content-addressed store, hash-verified

763}
764
765Status MockFileSystem::CreateFile(const std::string& path, std::string_view contents,
766 bool recursive) {
767 RETURN_NOT_OK(ValidatePath(path));
768 auto parent = fs::internal::GetAbstractPathParent(path).first;
769
770 if (parent != "") {
771 RETURN_NOT_OK(CreateDir(parent, recursive));
772 }
773
774 ARROW_ASSIGN_OR_RAISE(auto file, OpenOutputStream(path));
775 RETURN_NOT_OK(file->Write(contents));
776 return file->Close();
777}
778
779Result<std::shared_ptr<FileSystem>> MockFileSystem::Make(
780 TimePoint current_time, const std::vector<FileInfo>& infos) {

Callers 1

MakeMethod · 0.45

Calls 5

GetAbstractPathParentFunction · 0.85
ValidatePathFunction · 0.70
CreateDirFunction · 0.70
WriteMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected