MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / pushBack

Method pushBack

src/storage/disk_array.cpp:349–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

347}
348
349void DiskArrayInternal::WriteIterator::pushBack(PageAllocator& pageAllocator,
350 const Transaction* transaction, std::span<std::byte> val) {
351 idx = diskArray.headerForWriteTrx.numElements;
352 auto oldPageIdx = apCursor.pageIdx;
353 apCursor = getAPIdxAndOffsetInAP(diskArray.storageInfo, idx);
354 // If this would add a new page, pin new page and update PIP
355 auto [apPageIdx, isNewlyAdded] =
356 diskArray.getAPPageIdxAndAddAPToPIPIfNecessaryForWriteTrxNoLock(pageAllocator, transaction,
357 apCursor.pageIdx);
358 diskArray.lastAPPageIdx = apPageIdx;
359 // Used to calculate the number of APs, so it must be updated after the PIPs are.
360 diskArray.headerForWriteTrx.numElements++;
361 if (isNewlyAdded || shadowPageAndFrame.originalPage == INVALID_PAGE_IDX ||
362 apCursor.pageIdx != oldPageIdx) {
363 getPage(apPageIdx, isNewlyAdded);
364 }
365 memcpy(operator*().data(), val.data(), val.size());
366}
367
368void DiskArrayInternal::WriteIterator::unpin() {
369 if (shadowPageAndFrame.shadowPage != INVALID_PAGE_IDX) {

Callers 4

resizeMethod · 0.80
splitSlotsMethod · 0.80
mergeSlotMethod · 0.80
WriteIteratorClass · 0.80

Tested by

no test coverage detected