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

Method setupFile

src/jrd/TempSpace.cpp:481–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479//
480
481TempFile* TempSpace::setupFile(FB_SIZE_T size)
482{
483 StaticStatusVector status_vector;
484
485 for (FB_SIZE_T i = 0; i < tempDirs->getCount(); i++)
486 {
487 TempFile* file = NULL;
488
489 PathName directory = (*tempDirs)[i];
490 PathUtils::ensureSeparator(directory);
491
492 for (FB_SIZE_T j = 0; j < tempFiles.getCount(); j++)
493 {
494 PathName dirname, filename;
495 PathUtils::splitLastComponent(dirname, filename, tempFiles[j]->getName());
496 PathUtils::ensureSeparator(dirname);
497 if (!directory.compare(dirname))
498 {
499 file = tempFiles[j];
500 break;
501 }
502 }
503
504 try
505 {
506 if (!file)
507 {
508 file = FB_NEW_POOL(pool) TempFile(pool, filePrefix, directory);
509 tempFiles.add(file);
510 }
511
512 file->extend(size);
513 }
514 catch (const system_error& ex)
515 {
516 ex.stuffException(status_vector);
517 continue;
518 }
519
520 return file;
521 }
522
523 // no room in all directories
524 Arg::Gds status(isc_out_of_temp_space);
525 status.append(Arg::StatusVector(status_vector.begin()));
526 iscLogStatus(NULL, status.value());
527 status.raise();
528
529 return NULL; // compiler silencer
530}
531
532//
533// TempSpace::allocateSpace

Callers

nothing calls this directly

Calls 13

TempFileClass · 0.85
iscLogStatusFunction · 0.85
StatusVectorClass · 0.70
getCountMethod · 0.45
getNameMethod · 0.45
compareMethod · 0.45
addMethod · 0.45
extendMethod · 0.45
stuffExceptionMethod · 0.45
appendMethod · 0.45
beginMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected