| 1112 | } |
| 1113 | |
| 1114 | Status DataCache::Partition::DumpCacheFiles(DumpData& dump_data) { |
| 1115 | lock_.DCheckLocked(); |
| 1116 | int64_t index = 0; |
| 1117 | for (const auto& file : cache_files_) { |
| 1118 | // There is no need to dump closed file, it can no longer be read or written or even |
| 1119 | // deleted. |
| 1120 | if (file->closed()) continue; |
| 1121 | |
| 1122 | // Just to be safe, flush the file. |
| 1123 | RETURN_IF_ERROR(file->Flush()); |
| 1124 | |
| 1125 | dump_data.cache_files_data.emplace_back(file->path(), file->allow_append(), |
| 1126 | file->current_offset(), file->mtime()); |
| 1127 | auto result = dump_data.file_indexs.emplace(file.get(), index++); |
| 1128 | DCHECK(result.second); |
| 1129 | } |
| 1130 | return Status::OK(); |
| 1131 | } |
| 1132 | |
| 1133 | Status DataCache::Partition::LoadCacheFiles(const DumpData& dump_data) { |
| 1134 | lock_.DCheckLocked(); |
nothing calls this directly
no test coverage detected