| 1150 | } |
| 1151 | |
| 1152 | Status DataCache::Partition::DumpMetaCache(DumpData& dump_data) { |
| 1153 | lock_.DCheckLocked(); |
| 1154 | DCHECK(dump_data.cache_files_data.size() == dump_data.file_indexs.size()); |
| 1155 | |
| 1156 | // Walk through the meta cache, taking all keys and entries and dumping them one by one. |
| 1157 | vector<Cache::UniqueHandle> handles = meta_cache_->Dump(); |
| 1158 | for (const auto& handle : handles) { |
| 1159 | CacheEntry entry(meta_cache_->Value(handle)); |
| 1160 | auto index_iter = dump_data.file_indexs.find(entry.file()); |
| 1161 | // If the entry's cache file is not in the list, we do not need to dump it. |
| 1162 | if (index_iter == dump_data.file_indexs.end()) continue; |
| 1163 | dump_data.meta_cache_data.emplace_back(meta_cache_->Key(handle).ToString(), |
| 1164 | index_iter->second, entry.offset(), entry.len(), entry.checksum()); |
| 1165 | } |
| 1166 | return Status::OK(); |
| 1167 | } |
| 1168 | |
| 1169 | Status DataCache::Partition::LoadMetaCache(const DumpData& dump_data) { |
| 1170 | lock_.DCheckLocked(); |