Returns a vector of filtered KV refs from data which are either part of incomplete mutation groups OR complete and have data relevant to one of the KV ranges in ranges
| 3351 | // Returns a vector of filtered KV refs from data which are either part of incomplete mutation groups OR complete |
| 3352 | // and have data relevant to one of the KV ranges in ranges |
| 3353 | std::vector<KeyValueRef> filterLogMutationKVPairs(VectorRef<KeyValueRef> data, const std::vector<KeyRange>& ranges) { |
| 3354 | std::unordered_map<Version, AccumulatedMutations> mutationBlocksByVersion; |
| 3355 | |
| 3356 | for (auto& kv : data) { |
| 3357 | auto versionAndChunkNumber = decodeMutationLogKey(kv.key); |
| 3358 | mutationBlocksByVersion[versionAndChunkNumber.first].addChunk(versionAndChunkNumber.second, kv); |
| 3359 | } |
| 3360 | |
| 3361 | std::vector<KeyValueRef> output; |
| 3362 | |
| 3363 | for (auto& vb : mutationBlocksByVersion) { |
| 3364 | AccumulatedMutations& m = vb.second; |
| 3365 | |
| 3366 | // If the mutations are incomplete or match one of the ranges, include in results. |
| 3367 | if (!m.isComplete() || m.matchesAnyRange(ranges)) { |
| 3368 | output.insert(output.end(), m.kvs.begin(), m.kvs.end()); |
| 3369 | } |
| 3370 | } |
| 3371 | |
| 3372 | return output; |
| 3373 | } |
| 3374 | struct RestoreLogDataTaskFunc : RestoreFileTaskFuncBase { |
| 3375 | static StringRef name; |
| 3376 | static constexpr uint32_t version = 1; |
no test coverage detected