| 56 | #define BM_PURGE_DEBUG false |
| 57 | |
| 58 | void handleClientBlobRange(KeyRangeMap<bool>* knownBlobRanges, |
| 59 | Arena& ar, |
| 60 | VectorRef<KeyRangeRef>* rangesToAdd, |
| 61 | VectorRef<KeyRangeRef>* rangesToRemove, |
| 62 | KeyRef rangeStart, |
| 63 | KeyRef rangeEnd, |
| 64 | bool rangeActive) { |
| 65 | if (BM_DEBUG) { |
| 66 | fmt::print( |
| 67 | "db range [{0} - {1}): {2}\n", rangeStart.printable(), rangeEnd.printable(), rangeActive ? "T" : "F"); |
| 68 | } |
| 69 | KeyRange keyRange(KeyRangeRef(rangeStart, rangeEnd)); |
| 70 | auto allRanges = knownBlobRanges->intersectingRanges(keyRange); |
| 71 | for (auto& r : allRanges) { |
| 72 | if (r.value() != rangeActive) { |
| 73 | KeyRef overlapStart = (r.begin() > keyRange.begin) ? r.begin() : keyRange.begin; |
| 74 | KeyRef overlapEnd = (keyRange.end < r.end()) ? keyRange.end : r.end(); |
| 75 | KeyRangeRef overlap(overlapStart, overlapEnd); |
| 76 | if (rangeActive) { |
| 77 | if (BM_DEBUG) { |
| 78 | fmt::print("BM Adding client range [{0} - {1})\n", |
| 79 | overlapStart.printable().c_str(), |
| 80 | overlapEnd.printable().c_str()); |
| 81 | } |
| 82 | rangesToAdd->push_back_deep(ar, overlap); |
| 83 | } else { |
| 84 | if (BM_DEBUG) { |
| 85 | fmt::print("BM Removing client range [{0} - {1})\n", |
| 86 | overlapStart.printable().c_str(), |
| 87 | overlapEnd.printable().c_str()); |
| 88 | } |
| 89 | rangesToRemove->push_back_deep(ar, overlap); |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | knownBlobRanges->insert(keyRange, rangeActive); |
| 94 | } |
| 95 | |
| 96 | void updateClientBlobRanges(KeyRangeMap<bool>* knownBlobRanges, |
| 97 | RangeResult dbBlobRanges, |
no test coverage detected