MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / FileSystemCopyFile

Function FileSystemCopyFile

tensorflow/core/platform/env.cc:437–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

435}
436
437Status FileSystemCopyFile(FileSystem* src_fs, const string& src,
438 FileSystem* target_fs, const string& target) {
439 std::unique_ptr<RandomAccessFile> src_file;
440 TF_RETURN_IF_ERROR(src_fs->NewRandomAccessFile(src, &src_file));
441
442 std::unique_ptr<WritableFile> target_file;
443 TF_RETURN_IF_ERROR(target_fs->NewWritableFile(target, &target_file));
444
445 uint64 offset = 0;
446 std::unique_ptr<char[]> scratch(new char[kCopyFileBufferSize]);
447 Status s = Status::OK();
448 while (s.ok()) {
449 StringPiece result;
450 s = src_file->Read(offset, kCopyFileBufferSize, &result, scratch.get());
451 if (!(s.ok() || s.code() == error::OUT_OF_RANGE)) {
452 return s;
453 }
454 TF_RETURN_IF_ERROR(target_file->Append(result));
455 offset += result.size();
456 }
457 return target_file->Close();
458}
459
460// A ZeroCopyInputStream on a RandomAccessFile.
461namespace {

Callers 2

CopyFileMethod · 0.85
CopyFileMethod · 0.85

Calls 9

NewRandomAccessFileMethod · 0.45
NewWritableFileMethod · 0.45
okMethod · 0.45
ReadMethod · 0.45
getMethod · 0.45
codeMethod · 0.45
AppendMethod · 0.45
sizeMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected