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

Method enumerate

src/jrd/replication/Config.cpp:498–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496// Therefore it checks only the necessary settings.
497
498void Config::enumerate(ReplicaList& replicas)
499{
500 PathName dbName;
501 FbLocalStatus localStatus;
502
503 try
504 {
505 const PathName filename =
506 fb_utils::getPrefix(IConfigManager::DIR_CONF, REPLICATION_CFGFILE);
507
508 ConfigFile cfgFile(filename, ConfigFile::HAS_SUB_CONF |
509 ConfigFile::NATIVE_ORDER |
510 ConfigFile::CUSTOM_MACROS);
511
512 AutoPtr<Config> defConfig(FB_NEW Config);
513
514 bool defaultFound = false;
515
516 for (const auto& section : cfgFile.getParameters())
517 {
518 if (section.name != "database")
519 continue;
520
521 AutoPtr<Config> dbConfig;
522 Config* config = nullptr;
523
524 dbName = section.value.c_str();
525
526 if (dbName.empty())
527 {
528 if (defaultFound)
529 raiseError("Only one default DATABASE section is allowed");
530
531 defaultFound = true;
532 config = defConfig;
533 }
534 else
535 {
536 config = dbConfig = FB_NEW Config(*defConfig);
537 }
538
539 if (!section.sub)
540 continue;
541
542 for (const auto& el : section.sub->getParameters())
543 {
544 const string key(el.name.c_str());
545 string value(el.value);
546
547 if (value.isEmpty())
548 continue;
549
550 if (key == "journal_source_directory")
551 {
552 config->sourceDirectory = value.c_str();
553 PathUtils::ensureSeparator(config->sourceDirectory);
554 if (!checkAccess(&localStatus, config->sourceDirectory, key))
555 {

Callers

nothing calls this directly

Calls 15

getPrefixFunction · 0.85
checkAccessFunction · 0.85
StringToGuidFunction · 0.85
configErrorFunction · 0.85
parseBooleanFunction · 0.85
composeErrorFunction · 0.85
logReplicaStatusFunction · 0.85
raiseErrorFunction · 0.70
ConfigClass · 0.70
parseLongFunction · 0.70
ISC_expand_filenameFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected