| 70 | } |
| 71 | |
| 72 | void InitOrCheckMetaValue(const std::string& pathname, int64_t expected, bool init) { |
| 73 | bool exists = PosixFile::FileExists(pathname); |
| 74 | if (init) { |
| 75 | CHECK(!exists) << pathname; |
| 76 | std::ofstream ofs(pathname); |
| 77 | ofs << expected << std::endl; |
| 78 | } else { |
| 79 | CHECK(exists); |
| 80 | std::ifstream ifs(pathname); |
| 81 | int64_t value = 0; |
| 82 | ifs >> value; |
| 83 | if (value != expected) { LOG(FATAL) << "Check failed: " << pathname; } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | std::string GetChunkName(uint64_t chunk_id) { |
| 88 | const std::string chunk_name_wo_leading_zero = std::to_string(chunk_id); |