| 45 | } |
| 46 | |
| 47 | bool OverflowFileHandle::equals(TransactionType trxType, std::string_view keyToLookup, |
| 48 | const string_t& keyInEntry) const { |
| 49 | PageCursor cursor; |
| 50 | TypeUtils::decodeOverflowPtr(keyInEntry.overflowPtr, cursor.pageIdx, cursor.elemPosInPage); |
| 51 | auto lengthRead = 0u; |
| 52 | while (lengthRead < keyInEntry.len) { |
| 53 | auto numBytesToCheckInPage = std::min(static_cast<page_idx_t>(keyInEntry.len) - lengthRead, |
| 54 | END_OF_PAGE - cursor.elemPosInPage); |
| 55 | bool equal = true; |
| 56 | read(trxType, cursor.pageIdx, [&](auto* frame) { |
| 57 | equal = memcmp(keyToLookup.data() + lengthRead, frame + cursor.elemPosInPage, |
| 58 | numBytesToCheckInPage) == 0; |
| 59 | // Update the next page index |
| 60 | cursor.pageIdx = *reinterpret_cast<page_idx_t*>(frame + END_OF_PAGE); |
| 61 | }); |
| 62 | if (!equal) { |
| 63 | return false; |
| 64 | } |
| 65 | cursor.elemPosInPage = 0; |
| 66 | lengthRead += numBytesToCheckInPage; |
| 67 | } |
| 68 | return true; |
| 69 | } |
| 70 | |
| 71 | uint8_t* OverflowFileHandle::addANewPage(PageAllocator* pageAllocator) { |
| 72 | page_idx_t newPageIdx = overflowFile.getNewPageIdx(pageAllocator); |
nothing calls this directly
no test coverage detected