MCPcopy Create free account
hub / github.com/apple/foundationdb / getCursor

Function getCursor

fdbserver/VersionedBTree.actor.cpp:6086–6116  ·  view source on GitHub ↗

Get cursor into a BTree node, creating decode cache from boundaries if needed

Source from the content-addressed store, hash-verified

6084
6085 // Get cursor into a BTree node, creating decode cache from boundaries if needed
6086 inline BTreePage::BinaryTree::Cursor getCursor(const ArenaPage* page,
6087 const RedwoodRecordRef& lowerBound,
6088 const RedwoodRecordRef& upperBound) {
6089
6090 Reference<BTreePage::BinaryTree::DecodeCache> cache;
6091
6092 if (page->extra.valid()) {
6093 cache = page->extra.getReference<BTreePage::BinaryTree::DecodeCache>();
6094 } else {
6095 cache = makeReference<BTreePage::BinaryTree::DecodeCache>(lowerBound, upperBound, m_pDecodeCacheMemory);
6096
6097 debug_printf("Created DecodeCache for ptr=%p lower=%s upper=%s %s\n",
6098 page->data(),
6099 lowerBound.toString(false).c_str(),
6100 upperBound.toString(false).c_str(),
6101 ((BTreePage*)page->data())
6102 ->toString("cursor",
6103 lowerBound.value.present() ? lowerBound.getChildPage() : BTreeNodeLinkRef(),
6104 -1,
6105 lowerBound,
6106 upperBound)
6107 .c_str());
6108
6109 // Store decode cache into page based on height
6110 if (((BTreePage*)page->data())->height >= SERVER_KNOBS->REDWOOD_DECODECACHE_REUSE_MIN_HEIGHT) {
6111 page->extra = cache;
6112 }
6113 }
6114
6115 return BTreePage::BinaryTree::Cursor(cache, ((BTreePage*)page->mutateData())->tree());
6116 }
6117
6118 // Get cursor into a BTree node from a child link
6119 inline BTreePage::BinaryTree::Cursor getCursor(const ArenaPage* page, const BTreePage::BinaryTree::Cursor& link) {

Callers 2

actionMethod · 0.85
eraseMethod · 0.85

Calls 11

getChildPageMethod · 0.80
treeMethod · 0.80
mutateDataMethod · 0.80
CursorClass · 0.70
getMethod · 0.65
nextMethod · 0.65
validMethod · 0.45
dataMethod · 0.45
c_strMethod · 0.45
toStringMethod · 0.45
presentMethod · 0.45

Tested by

no test coverage detected