diff --git a/src/blackcore/db/databasereader.cpp b/src/blackcore/db/databasereader.cpp index 1a9951214..6c2f0b809 100644 --- a/src/blackcore/db/databasereader.cpp +++ b/src/blackcore/db/databasereader.cpp @@ -360,7 +360,7 @@ namespace BlackCore { Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "need single entity"); static const QDateTime e; - const CDbInfoList il(getSharedInfoObjects()); + const CDbInfoList il(this->getSharedInfoObjects()); if (il.isEmpty() || entity == CEntityFlags::NoEntity) { return e; } const CDbInfo info = il.findFirstByEntityOrDefault(entity); @@ -380,7 +380,7 @@ namespace BlackCore { if (!this->isInternetAccessible(QString("No network/internet access, will not read shared file headers for %1").arg(CEntityFlags::flagToString(entities)))) { return false; } - CEntityFlags::Entity allEntities(this->maskBySupportedEntities(entities)); + CEntityFlags::Entity allEntities = entities & CEntityFlags::AllDbEntitiesNoInfoObjects; CEntityFlags::Entity currentEntity = CEntityFlags::iterateDbEntities(allEntities); const CUrl urlSharedDbdata = CDatabaseReader::getWorkingSharedDbdataDirectoryUrl(); if (urlSharedDbdata.isEmpty()) @@ -430,7 +430,7 @@ namespace BlackCore CEntityFlags::Entity CDatabaseReader::getEntitesWithNewerHeaderTimestamp(CEntityFlags::Entity entities) const { - entities = this->maskBySupportedEntities(entities); // handled by this reader + entities &= CEntityFlags::AllDbEntitiesNoInfoObjects; CEntityFlags::Entity currentEntity = CEntityFlags::iterateDbEntities(entities); CEntityFlags::Entity newerEntities = CEntityFlags::NoEntity; while (currentEntity != CEntityFlags::NoEntity) @@ -446,7 +446,7 @@ namespace BlackCore CEntityFlags::Entity CDatabaseReader::getEntitesWithNewerSharedInfoObject(CEntityFlags::Entity entities) const { - entities = this->maskBySupportedEntities(entities); // handled by this reader + entities &= CEntityFlags::AllDbEntitiesNoInfoObjects; CEntityFlags::Entity currentEntity = CEntityFlags::iterateDbEntities(entities); CEntityFlags::Entity newerEntities = CEntityFlags::NoEntity; while (currentEntity != CEntityFlags::NoEntity) @@ -569,12 +569,12 @@ namespace BlackCore CEntityFlags::Entity CDatabaseReader::maskBySupportedEntities(CEntityFlags::Entity entities) const { - return entities & getSupportedEntities(); + return entities & this->getSupportedEntities(); } bool CDatabaseReader::supportsAnyOfEntities(CEntityFlags::Entity entities) const { - return static_cast(maskBySupportedEntities(entities)) > 0; + return static_cast(this->maskBySupportedEntities(entities)) > 0; } bool CDatabaseReader::hasCacheTimestampNewerThan(CEntityFlags::Entity entity, const QDateTime &threshold) const diff --git a/src/blackcore/db/infodatareader.cpp b/src/blackcore/db/infodatareader.cpp index 057206442..aef60e953 100644 --- a/src/blackcore/db/infodatareader.cpp +++ b/src/blackcore/db/infodatareader.cpp @@ -8,9 +8,11 @@ */ #include "blackcore/application.h" +#include "blackcore/webdataservices.h" #include "blackmisc/sequence.h" #include "blackmisc/logmessage.h" #include "blackmisc/network/networkutils.h" +#include "blackmisc/verify.h" #include "infodatareader.h" #include @@ -52,43 +54,70 @@ namespace BlackCore void CInfoDataReader::synchronizeCaches(CEntityFlags::Entity entities) { // no caching used here + BLACK_VERIFY_X(false, Q_FUNC_INFO, "Using this for CInfoDataReader makes no sense"); Q_UNUSED(entities); } void CInfoDataReader::admitCaches(CEntityFlags::Entity entities) { // no caching used here + BLACK_VERIFY_X(false, Q_FUNC_INFO, "Using this for CInfoDataReader makes no sense"); Q_UNUSED(entities); } void CInfoDataReader::invalidateCaches(CEntityFlags::Entity entities) { // no caching used here + BLACK_VERIFY_X(false, Q_FUNC_INFO, "Using this for CInfoDataReader makes no sense"); Q_UNUSED(entities); } QDateTime CInfoDataReader::getCacheTimestamp(CEntityFlags::Entity entity) const { - // no caching used here + // no own caching used here Q_UNUSED(entity); - return QDateTime(); + Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "Need single entity"); + Q_ASSERT_X(sApp, Q_FUNC_INFO, "Need sApp"); + + if (entity == CEntityFlags::DbInfoObjectEntity || entity == CEntityFlags::SharedInfoObjectEntity) + { + BLACK_VERIFY_X(false, Q_FUNC_INFO, "Using this for CInfoDataReader makes no sense"); + return QDateTime(); + } + + // Forward to web data services so I get cache data from other readers + //! \fixme bit of a hack to use web data services here + return sApp->getWebDataServices()->getCacheTimestamp(entity); } int CInfoDataReader::getCacheCount(CEntityFlags::Entity entity) const { - // no caching used here + // no own caching used here Q_UNUSED(entity); - return 0; + Q_ASSERT_X(CEntityFlags::isSingleEntity(entity), Q_FUNC_INFO, "Need single entity"); + Q_ASSERT_X(sApp, Q_FUNC_INFO, "Need sApp"); + + if (entity == CEntityFlags::DbInfoObjectEntity || entity == CEntityFlags::SharedInfoObjectEntity) + { + BLACK_VERIFY_X(false, Q_FUNC_INFO, "Using this for CInfoDataReader makes no sense"); + return 0; + } + + // Forward to web data services so I get cache data from other readers + //! \fixme bit of a hack to use web data services here + return sApp->getWebDataServices()->getCacheCount(entity); } CEntityFlags::Entity CInfoDataReader::getEntitiesWithCacheCount() const { + BLACK_VERIFY_X(false, Q_FUNC_INFO, "Using this for CInfoDataReader makes no sense"); return CEntityFlags::NoEntity; } CEntityFlags::Entity CInfoDataReader::getEntitiesWithCacheTimestampNewerThan(const QDateTime &threshold) const { Q_UNUSED(threshold); + BLACK_VERIFY_X(false, Q_FUNC_INFO, "Using this for CInfoDataReader makes no sense"); return CEntityFlags::NoEntity; }