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

Method CopyFile

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

Source from the content-addressed store, hash-verified

693}
694
695Status MockFileSystem::CopyFile(const std::string& src, const std::string& dest) {
696 return BinaryOp::Run(impl_.get(), src, dest, [&](const BinaryOp& op) -> Status {
697 if (op.src_entry == nullptr) {
698 return PathNotFound(src);
699 }
700 if (!op.src_entry->is_file()) {
701 return NotAFile(src);
702 }
703 if (op.dest_entry != nullptr && op.dest_entry->is_dir()) {
704 return Status::IOError("Cannot replace destination '", dest,
705 "', which is a directory");
706 }
707
708 // Copy original entry, fix its name
709 std::unique_ptr<Entry> new_entry(new Entry(File(op.src_entry->as_file())));
710 new_entry->SetName(op.dest_name);
711 op.dest_dir.AssignEntry(op.dest_name, std::move(new_entry));
712 return Status::OK();
713 });
714}
715
716Result<std::shared_ptr<io::InputStream>> MockFileSystem::OpenInputStream(
717 const std::string& path) {

Callers

nothing calls this directly

Calls 11

RunFunction · 0.85
IOErrorFunction · 0.85
is_fileMethod · 0.80
is_dirMethod · 0.80
SetNameMethod · 0.80
AssignEntryMethod · 0.80
PathNotFoundFunction · 0.70
NotAFileFunction · 0.70
FileClass · 0.70
OKFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected