Ref T24, preparations to read dbinfo.json for shared files

This will replace http header file timestamps
* read function in info reader has retrieval mode flag, unused parameters removed
* waitForDbInfoObjects/getDbInfoDataReader (added "Db"), there will be a 2nd reader
* CWebReaderFlags::DbInfoDataReader (added "Db")
* removed ps_read, only read (public)
This commit is contained in:
Klaus Basan
2017-04-20 02:26:21 +02:00
parent 65f4d1f9e2
commit 485c95101b
7 changed files with 79 additions and 97 deletions

View File

@@ -91,37 +91,17 @@ namespace BlackCore
return sApp->getGlobalSetup().getDbInfoReaderUrl();
}
void CInfoDataReader::read(CEntityFlags::Entity entities, const QDateTime &newerThan)
void CInfoDataReader::read()
{
this->ps_read(entities, CDbFlags::DbReading, newerThan);
}
void CInfoDataReader::ps_read(CEntityFlags::Entity entities, CDbFlags::DataRetrievalModeFlag mode, const QDateTime &newerThan)
{
Q_UNUSED(mode);
CEntityFlags::Entity triggeredRead = CEntityFlags::NoEntity;
CUrl url(getInfoObjectsUrl());
if (entities.testFlag(CEntityFlags::InfoObjectEntity))
const CUrl url(getDbInfoObjectsUrl());
if (!url.isEmpty())
{
if (!url.isEmpty())
{
if (!newerThan.isNull())
{
const QString tss(newerThan.toString(Qt::ISODate));
url.appendQuery(QString(parameterLatestTimestamp() + "=" + tss));
}
sApp->getFromNetwork(url, { this, &CInfoDataReader::ps_parseInfoObjectsData});
triggeredRead |= CEntityFlags::InfoObjectEntity;
}
else
{
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::InfoObjectEntity);
}
sApp->getFromNetwork(url, { this, &CInfoDataReader::ps_parseInfoObjectsData});
emit dataRead(CEntityFlags::InfoObjectEntity, CEntityFlags::StartRead, 0);
}
if (triggeredRead != CEntityFlags::NoEntity)
else
{
emit dataRead(triggeredRead, CEntityFlags::StartRead, 0);
CLogMessage(this).error("No URL for %1") << CEntityFlags::flagToString(CEntityFlags::InfoObjectEntity);
}
}
@@ -153,7 +133,7 @@ namespace BlackCore
this->emitAndLogDataRead(CEntityFlags::InfoObjectEntity, n, res);
}
CUrl CInfoDataReader::getInfoObjectsUrl() const
CUrl CInfoDataReader::getDbInfoObjectsUrl() const
{
return getBaseUrl(CDbFlags::DbReading).withAppendedPath("jsondbinfo.php");
}