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

Method get

src/storage/disk_array.cpp:85–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void DiskArrayInternal::get(uint64_t idx, const Transaction* transaction,
86 std::span<std::byte> val) {
87 std::shared_lock sLck{diskArraySharedMtx};
88 DASSERT(checkOutOfBoundAccess(transaction->getType(), idx));
89 auto apCursor = getAPIdxAndOffsetInAP(storageInfo, idx);
90 page_idx_t apPageIdx = getAPPageIdxNoLock(apCursor.pageIdx, transaction->getType());
91 if (transaction->getType() != TransactionType::CHECKPOINT || !hasTransactionalUpdates ||
92 apPageIdx > lastPageOnDisk ||
93 !shadowFile->hasShadowPage(fileHandle.getFileIndex(), apPageIdx)) {
94 fileHandle.optimisticReadPage(apPageIdx, [&](const uint8_t* frame) -> void {
95 memcpy(val.data(), frame + apCursor.elemPosInPage, val.size());
96 });
97 } else {
98 ShadowUtils::readShadowVersionOfPage(fileHandle, apPageIdx, *shadowFile,
99 [&val, &apCursor](const uint8_t* frame) -> void {
100 memcpy(val.data(), frame + apCursor.elemPosInPage, val.size());
101 });
102 }
103}
104
105void DiskArrayInternal::updatePage(uint64_t pageIdx, bool isNewPage,
106 std::function<void(uint8_t*)> updateOp) {

Callers 15

mainFunction · 0.45
EmbeddedShellMethod · 0.45
processInputMethod · 0.45
mainFunction · 0.45
printBodyMethod · 0.45
parseBenchmarkFileMethod · 0.45
runCaseFunction · 0.45
runAllBenchmarksMethod · 0.45
registerBenchmarkMethod · 0.45
loadBenchmarkMethod · 0.45
send_fileMethod · 0.45
getSourceMethod · 0.45

Calls 7

getAPIdxAndOffsetInAPFunction · 0.85
hasShadowPageMethod · 0.80
getFileIndexMethod · 0.80
optimisticReadPageMethod · 0.80
getTypeMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by 15

getSourceMethod · 0.36
getOpWithTypeMethod · 0.36
countOpsWithTypeMethod · 0.36
TEST_FFunction · 0.36
testStatementMethod · 0.36
SetUpMethod · 0.36
resetDBFlakyMethod · 0.36
TEST_FFunction · 0.36
detachDeleteNodeMethod · 0.36
operator==Function · 0.36
TEST_FFunction · 0.36