MCPcopy Create free account
hub / github.com/citp/BlockSci / lockDataDirectory

Function lockDataDirectory

tools/parser/main.cpp:50–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48using json = nlohmann::json;
49
50void lockDataDirectory(const blocksci::DataConfiguration &dataConfig) {
51 filesystem::path pidFile = dataConfig.pidFilePath();
52
53 if(pidFile.exists()) {
54 std::cout << "A PID file exists in the data directory, another parser instance might already be running. Aborting." << std::endl;
55 exit(1);
56 } else {
57 std::cout << "Locking data directory." << std::endl;
58 std::ofstream rawFile(pidFile.str());
59 rawFile << getpid();
60 rawFile.close();
61 }
62}
63
64void lockDataDirectory(const ParserConfigurationBase &config) {
65 lockDataDirectory(config.dataConfig);

Callers 1

mainFunction · 0.85

Calls 2

pidFilePathMethod · 0.80
existsMethod · 0.80

Tested by

no test coverage detected