MCPcopy Create free account
hub / github.com/apple/foundationdb / openFileImpl

Method openFileImpl

fdbbackup/FileDecoder.actor.cpp:419–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417 }
418
419 ACTOR static Future<Void> openFileImpl(DecodeProgress* self, Reference<IBackupContainer> container) {
420 Reference<IAsyncFile> fd = wait(container->readFile(self->file.fileName));
421 self->fd = fd;
422 if (self->save) {
423 std::string dir = self->file.fileName;
424 std::size_t found = self->file.fileName.find_last_of('/');
425 if (found != std::string::npos) {
426 std::string path = self->file.fileName.substr(0, found);
427 if (!directoryExists(path)) {
428 platform::createDirectory(path);
429 }
430 }
431 self->lfd = open(self->file.fileName.c_str(), O_WRONLY | O_CREAT | O_TRUNC, 0600);
432 if (self->lfd == -1) {
433 TraceEvent(SevError, "OpenLocalFileFailed").detail("File", self->file.fileName);
434 throw platform_error();
435 }
436 }
437 while (!self->eof) {
438 wait(readAndDecodeFile(self));
439 }
440 return Void();
441 }
442
443 // Add chunks to mutationBlocksByVersion
444 void addBlockKVPairs(VectorRef<KeyValueRef> chunks) {

Callers

nothing calls this directly

Calls 9

directoryExistsFunction · 0.85
createDirectoryFunction · 0.85
TraceEventClass · 0.85
substrMethod · 0.80
detailMethod · 0.80
openFunction · 0.50
VoidClass · 0.50
readFileMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected