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

Method createTmpFile

flow/Platform.actor.cpp:3262–3277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3260}
3261
3262void TmpFile::createTmpFile(const std::string_view dir, const std::string_view prefix) {
3263 std::string modelPattern = "%%%%-%%%%-%%%%-%%%%";
3264 boost::format fmter("%s/%s-%s");
3265 std::string modelPath = boost::str(boost::format(fmter % dir % prefix % modelPattern));
3266 boost::filesystem::path filePath = boost::filesystem::unique_path(modelPath);
3267
3268 filename = filePath.string();
3269
3270 // Create empty tmp file
3271 std::fstream tmpFile(filename, std::fstream::out);
3272 if (!tmpFile.good()) {
3273 TraceEvent("TmpFile_CreateFileError").detail("Filename", filename);
3274 throw io_error();
3275 }
3276 TraceEvent("TmpFile_CreateSuccess").detail("Filename", filename);
3277}
3278
3279size_t TmpFile::read(uint8_t* buff, size_t len) {
3280 return readFileBytes(filename, buff, len);

Callers

nothing calls this directly

Calls 4

strFunction · 0.85
TraceEventClass · 0.85
detailMethod · 0.80
formatFunction · 0.70

Tested by

no test coverage detected