MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / ensureCachePresence

Method ensureCachePresence

src/jrd/Mapping.cpp:1297–1335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1295{ }
1296
1297bool Mapping::ensureCachePresence(RefPtr<Mapping::Cache>& cache, const char* alias, const char* target,
1298 Mapping::DbHandle& hdb, ICryptKeyCallback* cryptCb, Mapping::Cache* c2)
1299{
1300 fb_assert(!cache);
1301 fb_assert(authBlock);
1302
1303 if (!(authBlock && authBlock->hasData()))
1304 return false;
1305
1306 MutexEnsureUnlock g(treeMutex, FB_FUNCTION);
1307 g.enter();
1308
1309 // Find cache in the tree or create new one
1310 locate(cache, alias, target);
1311 fb_assert(cache);
1312
1313 // If we use self security database no sense performing checks on it twice
1314 if (cache == c2)
1315 {
1316 cache = nullptr;
1317 return false;
1318 }
1319
1320 // Required cache(s) are locked somehow - release treeMutex
1321 g.leave();
1322
1323 // Std safe check for data presence in cache
1324 if (cache->dataFlag)
1325 return false;
1326 MutexLockGuard g2(cache->populateMutex, FB_FUNCTION);
1327 if (cache->dataFlag)
1328 return false;
1329
1330 // Create db attachment if missing it and populate cache from it
1331 bool down = hdb.attach(alias, cryptCb) || cache->populate(hdb);
1332 if (down)
1333 cache = nullptr;
1334 return down;
1335}
1336
1337
1338void Mapping::needAuthMethod(Firebird::string& method)

Callers

nothing calls this directly

Calls 6

locateFunction · 0.85
hasDataMethod · 0.45
enterMethod · 0.45
leaveMethod · 0.45
attachMethod · 0.45
populateMethod · 0.45

Tested by

no test coverage detected