mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 18:25:42 +08:00
[DB readers] misc fixes found during "datastore down" investigation
* added CEntityFlags::AircraftCategoryEntity in config lists * flag to name * missed initial reading of categories * style
This commit is contained in:
committed by
Mat Sutcliffe
parent
39907bf7ea
commit
0482b9883d
@@ -57,6 +57,7 @@ namespace BlackCore
|
|||||||
// we accept cached data
|
// we accept cached data
|
||||||
Q_ASSERT_X(!entities.testFlag(CEntityFlags::DbInfoObjectEntity), Q_FUNC_INFO, "Read info objects directly");
|
Q_ASSERT_X(!entities.testFlag(CEntityFlags::DbInfoObjectEntity), Q_FUNC_INFO, "Read info objects directly");
|
||||||
const bool hasDbInfoObjects = this->hasDbInfoObjects(); // no info objects is not necessarily an error, but indicates a) either data not available (DB down) or b) only caches are used
|
const bool hasDbInfoObjects = this->hasDbInfoObjects(); // no info objects is not necessarily an error, but indicates a) either data not available (DB down) or b) only caches are used
|
||||||
|
// const bool hasSharedInfoObjects = this->hasSharedInfoObjects();
|
||||||
CEntityFlags::Entity allEntities = entities;
|
CEntityFlags::Entity allEntities = entities;
|
||||||
CEntityFlags::Entity cachedEntities = CEntityFlags::NoEntity;
|
CEntityFlags::Entity cachedEntities = CEntityFlags::NoEntity;
|
||||||
CEntityFlags::Entity dbEntities = CEntityFlags::NoEntity;
|
CEntityFlags::Entity dbEntities = CEntityFlags::NoEntity;
|
||||||
@@ -82,7 +83,9 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
else if (rm.testFlag(CDbFlags::Cached))
|
else if (rm.testFlag(CDbFlags::Cached))
|
||||||
{
|
{
|
||||||
// info object comparisons only for: cache + shared or cache + DB data
|
//
|
||||||
|
// !!! info object comparisons only for: cache + shared or cache + DB data
|
||||||
|
//
|
||||||
if (hasDbInfoObjects && rmDbReadingOrShared)
|
if (hasDbInfoObjects && rmDbReadingOrShared)
|
||||||
{
|
{
|
||||||
// check mode here for consistency
|
// check mode here for consistency
|
||||||
|
|||||||
@@ -34,12 +34,12 @@ namespace BlackCore
|
|||||||
u' ' %
|
u' ' %
|
||||||
CEntityFlags::flagToString(this->getEntities()) %
|
CEntityFlags::flagToString(this->getEntities()) %
|
||||||
u' ' %
|
u' ' %
|
||||||
this->m_cacheLifetime.toQString(i18n);
|
m_cacheLifetime.toQString(i18n);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEntityFlags::Entity CDatabaseReaderConfig::getEntities() const
|
CEntityFlags::Entity CDatabaseReaderConfig::getEntities() const
|
||||||
{
|
{
|
||||||
return static_cast<CEntityFlags::Entity>(this->m_entities);
|
return static_cast<CEntityFlags::Entity>(m_entities);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDatabaseReaderConfig::supportsEntities(CEntityFlags::Entity entities) const
|
bool CDatabaseReaderConfig::supportsEntities(CEntityFlags::Entity entities) const
|
||||||
@@ -52,19 +52,19 @@ namespace BlackCore
|
|||||||
|
|
||||||
CDbFlags::DataRetrievalMode CDatabaseReaderConfig::getRetrievalMode() const
|
CDbFlags::DataRetrievalMode CDatabaseReaderConfig::getRetrievalMode() const
|
||||||
{
|
{
|
||||||
return static_cast<CDbFlags::DataRetrievalMode>(this->m_retrievalMode);
|
return static_cast<CDbFlags::DataRetrievalMode>(m_retrievalMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDatabaseReaderConfig::markAsDbDown()
|
void CDatabaseReaderConfig::markAsDbDown()
|
||||||
{
|
{
|
||||||
CDbFlags::DataRetrievalMode m = this->getRetrievalMode();
|
CDbFlags::DataRetrievalMode m = this->getRetrievalMode();
|
||||||
m = CDbFlags::adjustWhenDbIsDown(m);
|
m = CDbFlags::adjustWhenDbIsDown(m);
|
||||||
this->m_retrievalMode = static_cast<int>(m);
|
m_retrievalMode = static_cast<int>(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDatabaseReaderConfig::setCacheLifetime(const CTime &time)
|
void CDatabaseReaderConfig::setCacheLifetime(const CTime &time)
|
||||||
{
|
{
|
||||||
this->m_cacheLifetime = time;
|
m_cacheLifetime = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CDatabaseReaderConfig::possiblyReadsFromSwiftDb() const
|
bool CDatabaseReaderConfig::possiblyReadsFromSwiftDb() const
|
||||||
@@ -96,7 +96,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CDatabaseReaderConfig::isValid() const
|
bool CDatabaseReaderConfig::isValid() const
|
||||||
{
|
{
|
||||||
return this->m_entities != BlackMisc::Network::CEntityFlags::NoEntity;
|
return m_entities != CEntityFlags::NoEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
CDatabaseReaderConfigList::CDatabaseReaderConfigList(const CSequence<CDatabaseReaderConfig> &other) :
|
CDatabaseReaderConfigList::CDatabaseReaderConfigList(const CSequence<CDatabaseReaderConfig> &other) :
|
||||||
@@ -216,6 +216,7 @@ namespace BlackCore
|
|||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::ModelEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::ModelEntity, retrievalFlags, cacheLifetime));
|
||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::LiveryEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::LiveryEntity, retrievalFlags, cacheLifetime));
|
||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::CountryEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::CountryEntity, retrievalFlags, cacheLifetime));
|
||||||
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::AircraftCategoryEntity, retrievalFlags, cacheLifetime));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,6 +235,7 @@ namespace BlackCore
|
|||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::ModelEntity, retrievalFlagsWriting, cacheLifetime)); // for wizard
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::ModelEntity, retrievalFlagsWriting, cacheLifetime)); // for wizard
|
||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::LiveryEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::LiveryEntity, retrievalFlags, cacheLifetime));
|
||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::CountryEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::CountryEntity, retrievalFlags, cacheLifetime));
|
||||||
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::AircraftCategoryEntity, retrievalFlags, cacheLifetime));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +251,7 @@ namespace BlackCore
|
|||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::ModelEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::ModelEntity, retrievalFlags, cacheLifetime));
|
||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::LiveryEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::LiveryEntity, retrievalFlags, cacheLifetime));
|
||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::CountryEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::CountryEntity, retrievalFlags, cacheLifetime));
|
||||||
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::AircraftCategoryEntity, retrievalFlags, cacheLifetime));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,6 +267,7 @@ namespace BlackCore
|
|||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::ModelEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::ModelEntity, retrievalFlags, cacheLifetime));
|
||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::LiveryEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::LiveryEntity, retrievalFlags, cacheLifetime));
|
||||||
l.push_back(CDatabaseReaderConfig(CEntityFlags::CountryEntity, retrievalFlags, cacheLifetime));
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::CountryEntity, retrievalFlags, cacheLifetime));
|
||||||
|
l.push_back(CDatabaseReaderConfig(CEntityFlags::AircraftCategoryEntity, retrievalFlags, cacheLifetime));
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -784,7 +784,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CIcaoDataReader::hasChangedUrl(CEntityFlags::Entity entity, CUrl &oldUrlInfo, CUrl &newUrlInfo) const
|
bool CIcaoDataReader::hasChangedUrl(CEntityFlags::Entity entity, CUrl &oldUrlInfo, CUrl &newUrlInfo) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(entity);
|
Q_UNUSED(entity)
|
||||||
oldUrlInfo = m_readerUrlCache.get();
|
oldUrlInfo = m_readerUrlCache.get();
|
||||||
newUrlInfo = this->getBaseUrl(CDbFlags::DbReading);
|
newUrlInfo = this->getBaseUrl(CDbFlags::DbReading);
|
||||||
return CDatabaseReader::isChangedUrl(oldUrlInfo, newUrlInfo);
|
return CDatabaseReader::isChangedUrl(oldUrlInfo, newUrlInfo);
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
// trigger reading
|
// trigger reading
|
||||||
// but do not start all at the same time
|
// but do not start all at the same time
|
||||||
const CEntityFlags::Entity icaoPart = entities & CEntityFlags::AllIcaoAndCountries;
|
const CEntityFlags::Entity icaoPart = entities & CEntityFlags::AllIcaoCountriesCategory;
|
||||||
const CEntityFlags::Entity modelPart = entities & CEntityFlags::DistributorLiveryModel;
|
const CEntityFlags::Entity modelPart = entities & CEntityFlags::DistributorLiveryModel;
|
||||||
CEntityFlags::Entity remainingEntities = entities & ~icaoPart;
|
CEntityFlags::Entity remainingEntities = entities & ~icaoPart;
|
||||||
remainingEntities &= ~modelPart;
|
remainingEntities &= ~modelPart;
|
||||||
|
|||||||
@@ -29,7 +29,9 @@ namespace BlackMisc
|
|||||||
case Ignore: return "Ignore";
|
case Ignore: return "Ignore";
|
||||||
case Canceled: return "Canceled";
|
case Canceled: return "Canceled";
|
||||||
case DbReading: return "Direct DB access";
|
case DbReading: return "Direct DB access";
|
||||||
|
case DbWriting: return "DB writing";
|
||||||
case Shared: return "Shared data";
|
case Shared: return "Shared data";
|
||||||
|
case SharedInfoOnly: return "Shared info only";
|
||||||
case Cached: return "Cached data";
|
case Cached: return "Cached data";
|
||||||
default:
|
default:
|
||||||
BLACK_VERIFY_X(false, Q_FUNC_INFO, "wrong flags");
|
BLACK_VERIFY_X(false, Q_FUNC_INFO, "wrong flags");
|
||||||
@@ -45,7 +47,9 @@ namespace BlackMisc
|
|||||||
if (mode.testFlag(Ignore)) list << "Ignore";
|
if (mode.testFlag(Ignore)) list << "Ignore";
|
||||||
|
|
||||||
if (mode.testFlag(DbReading)) list << "Direct DB access";
|
if (mode.testFlag(DbReading)) list << "Direct DB access";
|
||||||
|
if (mode.testFlag(DbWriting)) list << "DB writing";
|
||||||
if (mode.testFlag(Shared)) list << "Shared data";
|
if (mode.testFlag(Shared)) list << "Shared data";
|
||||||
|
if (mode.testFlag(SharedInfoOnly)) list << "Shared info only";
|
||||||
if (mode.testFlag(Cached)) list << "Cached data";
|
if (mode.testFlag(Cached)) list << "Cached data";
|
||||||
return list.join(", ");
|
return list.join(", ");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user