mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
Ref T148, database reader extensions
* allow to set severity of failed reading * get entities with cached data * removed needsSharedInfoFileLoaded in CDatabaseReaderConfig
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c0a6574c80
commit
a2e888546e
@@ -122,6 +122,20 @@ namespace BlackCore
|
||||
return entity == CEntityFlags::AirportEntity ? m_airportCache.get().size() : 0;
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CAirportDataReader::getEntitiesWithCacheCount() const
|
||||
{
|
||||
CEntityFlags::Entity entities = CEntityFlags::NoEntity;
|
||||
if (this->getCacheCount(CEntityFlags::AirportEntity) > 0) { entities |= CEntityFlags::AirportEntity; }
|
||||
return entities;
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CAirportDataReader::getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const
|
||||
{
|
||||
CEntityFlags::Entity entities = CEntityFlags::NoEntity;
|
||||
if (this->hasCacheTimestampNewerThan(CEntityFlags::AirportEntity, threshold)) { entities |= CEntityFlags::AirportEntity; }
|
||||
return entities;
|
||||
}
|
||||
|
||||
void CAirportDataReader::synchronizeCaches(CEntityFlags::Entity entities)
|
||||
{
|
||||
if (entities.testFlag(CEntityFlags::AirportEntity)) { this->m_airportCache.synchronize(); }
|
||||
@@ -227,7 +241,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::AirportEntity);
|
||||
this->logNoWorkingUrl(CEntityFlags::AirportEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,8 @@ namespace BlackCore
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getSupportedEntities() const override;
|
||||
virtual QDateTime getCacheTimestamp(BlackMisc::Network::CEntityFlags::Entity entities) const override;
|
||||
virtual int getCacheCount(BlackMisc::Network::CEntityFlags::Entity entity) const override;
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheCount() const override;
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const override;
|
||||
virtual void synchronizeCaches(BlackMisc::Network::CEntityFlags::Entity entities) override;
|
||||
virtual void admitCaches(BlackMisc::Network::CEntityFlags::Entity entities) override;
|
||||
|
||||
|
||||
@@ -107,9 +107,8 @@ namespace BlackCore
|
||||
if (changedUrl)
|
||||
{
|
||||
CLogMessage(this).info("Data location for '%1' changed ('%2'->'%3'), will override cache for reading '%4'")
|
||||
<< currentEntityName
|
||||
<< oldUrlInfo.toQString() << newUrlInfo.toQString()
|
||||
<< rmDbOrSharedFlagString;
|
||||
<< currentEntityName << oldUrlInfo.toQString()
|
||||
<< newUrlInfo.toQString() << rmDbOrSharedFlagString;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -483,6 +482,12 @@ namespace BlackCore
|
||||
CLogMessage(this).info("Read %1 entities of '%2' from '%3' (%4)") << number << CEntityFlags::flagToString(entity) << res.getUrlString() << res.getLoadTimeString();
|
||||
}
|
||||
|
||||
void CDatabaseReader::logNoWorkingUrl(CEntityFlags::Entity entity)
|
||||
{
|
||||
const CStatusMessage msg = CStatusMessage(this, m_severityNoWorkingUrl, "No working URL for '%1'") << CEntityFlags::flagToString(entity);
|
||||
CLogMessage::preformatted(msg);
|
||||
}
|
||||
|
||||
CUrl CDatabaseReader::getBaseUrl(CDbFlags::DataRetrievalModeFlag mode) const
|
||||
{
|
||||
Q_ASSERT_X(sApp, Q_FUNC_INFO, "Missing app object, URLs cannot be obtained");
|
||||
@@ -562,6 +567,13 @@ namespace BlackCore
|
||||
return static_cast<int>(maskBySupportedEntities(entities)) > 0;
|
||||
}
|
||||
|
||||
bool CDatabaseReader::hasCacheTimestampNewerThan(CEntityFlags::Entity entity, const QDateTime &threshold) const
|
||||
{
|
||||
const QDateTime ts = this->getCacheTimestamp(entity);
|
||||
if (!ts.isValid()) return false;
|
||||
return ts > threshold;
|
||||
}
|
||||
|
||||
const QString &CDatabaseReader::getStatusMessage() const
|
||||
{
|
||||
return this->m_statusMessage;
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace BlackCore
|
||||
qulonglong m_contentLengthHeader = 0; //!< content length
|
||||
qint64 m_loadTimeMs = -1; //!< how long did it take to load
|
||||
BlackMisc::CStatusMessage m_message; //!< last error or warning
|
||||
BlackMisc::Network::CUrl m_url; //!< loaded url
|
||||
BlackMisc::Network::CUrl m_url; //!< loaded URL
|
||||
|
||||
public:
|
||||
//! Any timestamp?
|
||||
@@ -177,9 +177,21 @@ namespace BlackCore
|
||||
//! Get cache timestamp
|
||||
virtual QDateTime getCacheTimestamp(BlackMisc::Network::CEntityFlags::Entity entity) const = 0;
|
||||
|
||||
//! Has entity a valid and newer timestamp
|
||||
bool hasCacheTimestampNewerThan(BlackMisc::Network::CEntityFlags::Entity entity, const QDateTime &threshold) const;
|
||||
|
||||
//! Cache`s number of entities
|
||||
//! \remark this only works if the cache is admitted, DB caches are read deferred
|
||||
virtual int getCacheCount(BlackMisc::Network::CEntityFlags::Entity entity) const = 0;
|
||||
|
||||
//! Entities already having data in cache
|
||||
//! \remark this only works if the cache is admitted, DB caches are read deferred
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheCount() const = 0;
|
||||
|
||||
//! Entities already having data in cache (based on timestamp assumption)
|
||||
//! \remark unlike getEntitiesWithCacheCount() this even works when the cache is not yet admitted
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const = 0;
|
||||
|
||||
//! DB info objects available?
|
||||
bool hasDbInfoObjects() const;
|
||||
|
||||
@@ -223,6 +235,9 @@ namespace BlackCore
|
||||
//! Status message (error message)
|
||||
const QString &getStatusMessage() const;
|
||||
|
||||
//! Severity used for log messages in case of no URLs
|
||||
void setSeverityNoWorkingUrl(BlackMisc::CStatusMessage::StatusSeverity s) { m_severityNoWorkingUrl = s; }
|
||||
|
||||
//! Log categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
|
||||
@@ -253,6 +268,7 @@ namespace BlackCore
|
||||
mutable QReadWriteLock m_statusLock; //!< Lock
|
||||
QNetworkReply::NetworkError m_1stReplyStatus = QNetworkReply::UnknownServerError; //!< Successful connection?
|
||||
QMap<BlackMisc::Network::CEntityFlags::Entity, HeaderResponse> m_sharedFileResponses; //!< file responses of the shared files
|
||||
BlackMisc::CStatusMessage::StatusSeverity m_severityNoWorkingUrl = BlackMisc::CStatusMessage::SeverityError; //!< severity of message if there is no working URL
|
||||
|
||||
//! Constructor
|
||||
CDatabaseReader(QObject *owner, const CDatabaseReaderConfigList &config, const QString &name);
|
||||
@@ -280,6 +296,9 @@ namespace BlackCore
|
||||
//! Get the service URL, individual for each reader
|
||||
virtual BlackMisc::Network::CUrl getDbServiceBaseUrl() const = 0;
|
||||
|
||||
//! Log if no working URL exists, using m_noWorkingUrlSeverity
|
||||
void logNoWorkingUrl(BlackMisc::Network::CEntityFlags::Entity entity);
|
||||
|
||||
//! Base URL
|
||||
BlackMisc::Network::CUrl getBaseUrl(BlackMisc::Db::CDbFlags::DataRetrievalModeFlag mode) const;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
// without the Doxygen exclusion I get a strange no matching class member found for warning in the gcc build
|
||||
|
||||
#include "blackcore/db/databasereaderconfig.h"
|
||||
#include <QStringBuilder>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Db;
|
||||
@@ -22,19 +23,19 @@ namespace BlackCore
|
||||
namespace Db
|
||||
{
|
||||
CDatabaseReaderConfig::CDatabaseReaderConfig(CEntityFlags::Entity entities, CDbFlags::DataRetrievalMode retrievalFlags, const CTime &cacheLifetime) :
|
||||
m_entities(entities), m_retrievalFlags(retrievalFlags), m_cacheLifetime(cacheLifetime)
|
||||
m_entities(entities), m_retrievalMode(retrievalFlags), m_cacheLifetime(cacheLifetime)
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
QString CDatabaseReaderConfig::convertToQString(bool i18n) const
|
||||
{
|
||||
QString s(CDbFlags::flagToString(this->getRetrievalMode()));
|
||||
s.append(" ");
|
||||
s.append(CEntityFlags::flagToString(this->getEntities()));
|
||||
s.append(" ");
|
||||
s.append(this->m_cacheLifetime.toFormattedQString(i18n));
|
||||
return s;
|
||||
return
|
||||
CDbFlags::flagToString(this->getRetrievalMode()) %
|
||||
QStringLiteral(" ") %
|
||||
CEntityFlags::flagToString(this->getEntities()) %
|
||||
QStringLiteral(" ") %
|
||||
this->m_cacheLifetime.toFormattedQString(i18n);
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CDatabaseReaderConfig::getEntities() const
|
||||
@@ -52,14 +53,14 @@ namespace BlackCore
|
||||
|
||||
CDbFlags::DataRetrievalMode CDatabaseReaderConfig::getRetrievalMode() const
|
||||
{
|
||||
return static_cast<CDbFlags::DataRetrievalMode>(this->m_retrievalFlags);
|
||||
return static_cast<CDbFlags::DataRetrievalMode>(this->m_retrievalMode);
|
||||
}
|
||||
|
||||
void CDatabaseReaderConfig::markAsDbDown()
|
||||
{
|
||||
CDbFlags::DataRetrievalMode m = this->getRetrievalMode();
|
||||
m = CDbFlags::adjustWhenDbIsDown(m);
|
||||
this->m_retrievalFlags = static_cast<int>(m);
|
||||
this->m_retrievalMode = static_cast<int>(m);
|
||||
}
|
||||
|
||||
void CDatabaseReaderConfig::setCacheLifetime(const CTime &time)
|
||||
@@ -81,13 +82,6 @@ namespace BlackCore
|
||||
return (this->getRetrievalMode().testFlag(CDbFlags::Shared) || this->getRetrievalMode().testFlag(CDbFlags::SharedInfoOnly));
|
||||
}
|
||||
|
||||
bool CDatabaseReaderConfig::needsSharedInfoFileLoaded() const
|
||||
{
|
||||
if (!this->isValid()) { return false; }
|
||||
if (!CEntityFlags::anySwiftDbEntity(this->getEntities())) { return false; }
|
||||
return (this->getRetrievalMode().testFlag(CDbFlags::Shared));
|
||||
}
|
||||
|
||||
bool CDatabaseReaderConfig::possiblyWritesToSwiftDb() const
|
||||
{
|
||||
if (!this->isValid()) { return false; }
|
||||
@@ -172,12 +166,27 @@ namespace BlackCore
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CDatabaseReaderConfigList::needsSharedInfoFileLoaded(CEntityFlags::Entity entities) const
|
||||
bool CDatabaseReaderConfigList::needsSharedInfoFile(CEntityFlags::Entity entities) const
|
||||
{
|
||||
for (const CDatabaseReaderConfig &config : *this)
|
||||
{
|
||||
if (!config.supportsEntities(entities)) { continue; }
|
||||
if (config.needsSharedInfoFileLoaded()) { return true; }
|
||||
if (config.needsSharedInfoFile()) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CDatabaseReaderConfigList::needsSharedInfoObjectsIfCachesEmpty(CEntityFlags::Entity entities, CEntityFlags::Entity cachedEntities) const
|
||||
{
|
||||
for (const CDatabaseReaderConfig &config : *this)
|
||||
{
|
||||
if (!config.supportsEntities(entities)) { continue; }
|
||||
if (!config.needsSharedInfoFile()) { continue; }
|
||||
if (!config.getRetrievalMode().testFlag(CDbFlags::Cached)) { return true; } // does not support caching
|
||||
|
||||
const CEntityFlags::Entity configEntities = config.getEntities();
|
||||
const CEntityFlags::Entity configEntitiesNotCached = configEntities & ~cachedEntities;
|
||||
if (configEntitiesNotCached != CEntityFlags::NoEntity) { return true; } // we have entities not yet cached
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,12 +65,10 @@ namespace BlackCore
|
||||
//! Will read from swift DB
|
||||
bool possiblyReadsFromSwiftDb() const;
|
||||
|
||||
//! Needs the shared header
|
||||
//! Needs the DB info file loaded
|
||||
//! \remark a possible counterpart for the DB info file is possiblyReadsFromSwiftDb
|
||||
bool needsSharedInfoFile() const;
|
||||
|
||||
//! Needs the shared header loaded before it can be continued
|
||||
bool needsSharedInfoFileLoaded() const;
|
||||
|
||||
//! Will write to swift DB
|
||||
bool possiblyWritesToSwiftDb() const;
|
||||
|
||||
@@ -81,14 +79,14 @@ namespace BlackCore
|
||||
bool isValid() const;
|
||||
|
||||
private:
|
||||
int m_entities = BlackMisc::Network::CEntityFlags::NoEntity; //!< BlackMisc::Network::CEntityFlags::Entity
|
||||
int m_retrievalFlags = BlackMisc::Db::CDbFlags::DbReading; //!< BlackMisc::Db::CDbFlags::DataRetrievalMode
|
||||
int m_entities = BlackMisc::Network::CEntityFlags::NoEntity; //!< BlackMisc::Network::CEntityFlags::Entity
|
||||
int m_retrievalMode = BlackMisc::Db::CDbFlags::DbReading; //!< BlackMisc::Db::CDbFlags::DataRetrievalMode
|
||||
BlackMisc::PhysicalQuantities::CTime m_cacheLifetime;
|
||||
|
||||
BLACK_METACLASS(
|
||||
CDatabaseReaderConfig,
|
||||
BLACK_METAMEMBER(entities),
|
||||
BLACK_METAMEMBER(retrievalFlags),
|
||||
BLACK_METAMEMBER(retrievalMode),
|
||||
BLACK_METAMEMBER(cacheLifetime));
|
||||
};
|
||||
|
||||
@@ -106,7 +104,8 @@ namespace BlackCore
|
||||
//! Construct from a base class object.
|
||||
CDatabaseReaderConfigList(const CSequence<CDatabaseReaderConfig> &other);
|
||||
|
||||
//! FInd first one matching given
|
||||
//! Find first one matching given
|
||||
//! \remark works for single and multiple entities
|
||||
CDatabaseReaderConfig findFirstOrDefaultForEntity(const BlackMisc::Network::CEntityFlags::Entity entities) const;
|
||||
|
||||
//! DB is down
|
||||
@@ -121,11 +120,17 @@ namespace BlackCore
|
||||
//! Will write to swift DB
|
||||
bool possiblyWritesToSwiftDb() const;
|
||||
|
||||
//! Needs any shared header
|
||||
//! Needs any shared info object
|
||||
bool needsSharedInfoObjects(BlackMisc::Network::CEntityFlags::Entity entities) const;
|
||||
|
||||
//! Needs any shared info object, but only if the cache is empty
|
||||
//! \remark needs readers initialized
|
||||
bool needsSharedInfoObjectsIfCachesEmpty(
|
||||
BlackMisc::Network::CEntityFlags::Entity entities,
|
||||
BlackMisc::Network::CEntityFlags::Entity cachedEntities) const;
|
||||
|
||||
//! Needs any shared header loaded before continued
|
||||
bool needsSharedInfoFileLoaded(BlackMisc::Network::CEntityFlags::Entity entities) const;
|
||||
bool needsSharedInfoFile(BlackMisc::Network::CEntityFlags::Entity entities) const;
|
||||
|
||||
//! Entities which will use cache or DB, so no canceled or ignored ones
|
||||
BlackMisc::Network::CEntityFlags::Entity getEntitesCachedOrReadFromDB() const;
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::AircraftIcaoEntity);
|
||||
this->logNoWorkingUrl(CEntityFlags::AircraftIcaoEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::AirlineIcaoEntity);
|
||||
this->logNoWorkingUrl(CEntityFlags::AirlineIcaoEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::CountryEntity);
|
||||
this->logNoWorkingUrl(CEntityFlags::CountryEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,6 +557,24 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CIcaoDataReader::getEntitiesWithCacheCount() const
|
||||
{
|
||||
CEntityFlags::Entity entities = CEntityFlags::NoEntity;
|
||||
if (this->getCacheCount(CEntityFlags::AircraftIcaoEntity) > 0) entities |= CEntityFlags::AircraftIcaoEntity;
|
||||
if (this->getCacheCount(CEntityFlags::AirlineIcaoEntity) > 0) entities |= CEntityFlags::AirlineIcaoEntity;
|
||||
if (this->getCacheCount(CEntityFlags::CountryEntity) > 0) entities |= CEntityFlags::CountryEntity;
|
||||
return entities;
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CIcaoDataReader::getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const
|
||||
{
|
||||
CEntityFlags::Entity entities = CEntityFlags::NoEntity;
|
||||
if (this->hasCacheTimestampNewerThan(CEntityFlags::AircraftIcaoEntity, threshold)) entities |= CEntityFlags::AircraftIcaoEntity;
|
||||
if (this->hasCacheTimestampNewerThan(CEntityFlags::AirlineIcaoEntity, threshold)) entities |= CEntityFlags::AirlineIcaoEntity;
|
||||
if (this->hasCacheTimestampNewerThan(CEntityFlags::CountryEntity, threshold)) entities |= CEntityFlags::CountryEntity;
|
||||
return entities;
|
||||
}
|
||||
|
||||
bool CIcaoDataReader::hasChangedUrl(CEntityFlags::Entity entity, CUrl &oldUrlInfo, CUrl &newUrlInfo) const
|
||||
{
|
||||
Q_UNUSED(entity);
|
||||
|
||||
@@ -122,6 +122,8 @@ namespace BlackCore
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getSupportedEntities() const override;
|
||||
virtual QDateTime getCacheTimestamp(BlackMisc::Network::CEntityFlags::Entity entity) const override;
|
||||
virtual int getCacheCount(BlackMisc::Network::CEntityFlags::Entity entity) const override;
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheCount() const override;
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const override;
|
||||
virtual void synchronizeCaches(BlackMisc::Network::CEntityFlags::Entity entities) override;
|
||||
virtual void admitCaches(BlackMisc::Network::CEntityFlags::Entity entities) override;
|
||||
|
||||
|
||||
@@ -81,10 +81,25 @@ namespace BlackCore
|
||||
return 0;
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CInfoDataReader::getEntitiesWithCacheCount() const
|
||||
{
|
||||
CEntityFlags::Entity entities = CEntityFlags::NoEntity;
|
||||
return entities;
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CInfoDataReader::getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const
|
||||
{
|
||||
Q_UNUSED(threshold);
|
||||
CEntityFlags::Entity entities = CEntityFlags::NoEntity;
|
||||
return entities;
|
||||
}
|
||||
|
||||
bool CInfoDataReader::hasChangedUrl(CEntityFlags::Entity entity, CUrl &oldUrlInfo, CUrl &newUrlInfo) const
|
||||
{
|
||||
// not implemented
|
||||
Q_UNUSED(entity);
|
||||
|
||||
// init the URLs
|
||||
oldUrlInfo = this->getBaseUrl(CDbFlags::DbReading);
|
||||
newUrlInfo = this->getBaseUrl(CDbFlags::DbReading);
|
||||
return false;
|
||||
@@ -106,7 +121,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("No URL for '%1'") << CEntityFlags::flagToString(this->getEntityForMode());
|
||||
this->logNoWorkingUrl(this->getEntityForMode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,8 +177,7 @@ namespace BlackCore
|
||||
{
|
||||
case CDbFlags::DbReading: return getDbInfoObjectsUrl();
|
||||
case CDbFlags::Shared: return getSharedInfoObjectsUrl();
|
||||
default:
|
||||
qFatal("Wrong mode");
|
||||
default: qFatal("Wrong mode");
|
||||
}
|
||||
return CUrl();
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ namespace BlackCore
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getSupportedEntities() const override;
|
||||
virtual QDateTime getCacheTimestamp(BlackMisc::Network::CEntityFlags::Entity entity) const override;
|
||||
virtual int getCacheCount(BlackMisc::Network::CEntityFlags::Entity entity) const override;
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheCount() const override;
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const override;
|
||||
virtual void synchronizeCaches(BlackMisc::Network::CEntityFlags::Entity entities) override;
|
||||
virtual void admitCaches(BlackMisc::Network::CEntityFlags::Entity entities) override;
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::LiveryEntity);
|
||||
this->logNoWorkingUrl(CEntityFlags::LiveryEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::DistributorEntity);
|
||||
this->logNoWorkingUrl(CEntityFlags::DistributorEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace BlackCore
|
||||
}
|
||||
else
|
||||
{
|
||||
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::ModelEntity);
|
||||
this->logNoWorkingUrl(CEntityFlags::ModelEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,6 +569,24 @@ namespace BlackCore
|
||||
}
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CModelDataReader::getEntitiesWithCacheCount() const
|
||||
{
|
||||
CEntityFlags::Entity entities = CEntityFlags::NoEntity;
|
||||
if (this->getCacheCount(CEntityFlags::LiveryEntity) > 0) entities |= CEntityFlags::LiveryEntity;
|
||||
if (this->getCacheCount(CEntityFlags::ModelEntity) > 0) entities |= CEntityFlags::ModelEntity;
|
||||
if (this->getCacheCount(CEntityFlags::DistributorEntity) > 0) entities |= CEntityFlags::DistributorEntity;
|
||||
return entities;
|
||||
}
|
||||
|
||||
CEntityFlags::Entity CModelDataReader::getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const
|
||||
{
|
||||
CEntityFlags::Entity entities = CEntityFlags::NoEntity;
|
||||
if (this->hasCacheTimestampNewerThan(CEntityFlags::LiveryEntity, threshold)) entities |= CEntityFlags::LiveryEntity;
|
||||
if (this->hasCacheTimestampNewerThan(CEntityFlags::ModelEntity, threshold)) entities |= CEntityFlags::ModelEntity;
|
||||
if (this->hasCacheTimestampNewerThan(CEntityFlags::DistributorEntity, threshold)) entities |= CEntityFlags::DistributorEntity;
|
||||
return entities;
|
||||
}
|
||||
|
||||
bool CModelDataReader::hasChangedUrl(CEntityFlags::Entity entity, CUrl &oldUrlInfo, CUrl &newUrlInfo) const
|
||||
{
|
||||
Q_UNUSED(entity);
|
||||
|
||||
@@ -132,6 +132,8 @@ namespace BlackCore
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getSupportedEntities() const override;
|
||||
virtual QDateTime getCacheTimestamp(BlackMisc::Network::CEntityFlags::Entity entity) const override;
|
||||
virtual int getCacheCount(BlackMisc::Network::CEntityFlags::Entity entity) const override;
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheCount() const override;
|
||||
virtual BlackMisc::Network::CEntityFlags::Entity getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const override;
|
||||
virtual void synchronizeCaches(BlackMisc::Network::CEntityFlags::Entity entities) override;
|
||||
virtual void admitCaches(BlackMisc::Network::CEntityFlags::Entity entities) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user