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

Method tryGetPKIndex

src/storage/table/node_table.cpp:809–828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

807}
808
809PrimaryKeyIndex* NodeTable::tryGetPKIndex() const {
810 const auto index = getIndex(PrimaryKeyIndex::DEFAULT_NAME);
811 if (!index.has_value()) {
812 for (auto& indexHolder : indexes) {
813 if (!indexHolder.isLoaded()) {
814 continue;
815 }
816 auto* loadedIndex = indexHolder.getIndex();
817 if (loadedIndex->isPrimary() &&
818 loadedIndex->getIndexInfo().indexType == PrimaryKeyIndex::getIndexType().typeName) {
819 return &loadedIndex->cast<PrimaryKeyIndex>();
820 }
821 }
822 return nullptr;
823 }
824 if (index.value()->getIndexInfo().indexType != PrimaryKeyIndex::getIndexType().typeName) {
825 return nullptr;
826 }
827 return &index.value()->cast<PrimaryKeyIndex>();
828}
829
830Index* NodeTable::tryGetPrimaryKeyIndex() const {
831 if (auto* pkIndex = tryGetPKIndex()) {

Callers 3

TEST_FFunction · 0.80
TEST_FFunction · 0.80
initPKIndexMethod · 0.80

Calls 3

getIndexTypeFunction · 0.85
isLoadedMethod · 0.80
getIndexMethod · 0.45

Tested by 2

TEST_FFunction · 0.64
TEST_FFunction · 0.64