refs #921, changed setup/reader to distribution URL

This commit is contained in:
Klaus Basan
2017-03-30 17:58:44 +02:00
committed by Mathew Sutcliffe
parent 10c8f7c50a
commit 9faad01c8b
4 changed files with 22 additions and 24 deletions

View File

@@ -155,10 +155,10 @@ namespace BlackCore
return setup; return setup;
} }
CUrlList CGlobalSetup::getUpdateInfoFileUrls() const CUrlList CGlobalSetup::getDistributionUrls() const
{ {
const CUrlList urls(m_sharedUrls); const CUrlList urls(m_sharedUrls);
return urls.appendPath(CGlobalSetup::versionString() + "/updateinfo/updateinfo.json"); return urls.appendPath(CGlobalSetup::versionString() + "/updateinfo/distribution.json");
} }
CUrlList CGlobalSetup::getSwiftDbDataFileLocationUrls() const CUrlList CGlobalSetup::getSwiftDbDataFileLocationUrls() const
@@ -194,8 +194,8 @@ namespace BlackCore
s.append(boolToYesNo(isDevelopment())); s.append(boolToYesNo(isDevelopment()));
s.append(separator); s.append(separator);
s.append("Update info URLs: "); s.append("Distribution URLs: ");
s.append(getUpdateInfoFileUrls().toQString(i18n)); s.append(getDistributionUrls().toQString(i18n));
s.append(separator); s.append(separator);
s.append("Bootstrap URLs: "); s.append("Bootstrap URLs: ");
s.append(getBootstrapFileUrls().toQString(i18n)); s.append(getBootstrapFileUrls().toQString(i18n));
@@ -270,7 +270,7 @@ namespace BlackCore
case IndexVatsimMetars: case IndexVatsimMetars:
return CVariant::fromValue(this->m_vatsimMetarsUrls); return CVariant::fromValue(this->m_vatsimMetarsUrls);
case IndexUpdateInfo: case IndexUpdateInfo:
return CVariant::fromValue(this->getUpdateInfoFileUrls()); return CVariant::fromValue(this->getDistributionUrls());
case IndexBootstrapFileUrls: case IndexBootstrapFileUrls:
return CVariant::fromValue(this->getBootstrapFileUrls()); return CVariant::fromValue(this->getBootstrapFileUrls());
case IndexSwiftDbFiles: case IndexSwiftDbFiles:

View File

@@ -132,7 +132,7 @@ namespace BlackCore
BlackMisc::Network::CUrlList getBootstrapFileUrls() const; BlackMisc::Network::CUrlList getBootstrapFileUrls() const;
//! Version and download locations //! Version and download locations
BlackMisc::Network::CUrlList getUpdateInfoFileUrls() const; BlackMisc::Network::CUrlList getDistributionUrls() const;
//! Alternative locations of swift DB data files //! Alternative locations of swift DB data files
BlackMisc::Network::CUrlList getSwiftDbDataFileLocationUrls() const; BlackMisc::Network::CUrlList getSwiftDbDataFileLocationUrls() const;

View File

@@ -81,7 +81,7 @@ namespace BlackCore
); );
if (this->m_bootstrapMode == CacheOnly) if (this->m_bootstrapMode == CacheOnly)
{ {
this->m_updateInfoUrls = cachedSetup.getUpdateInfoFileUrls(); this->m_distributionUrls = cachedSetup.getDistributionUrls();
msgs.push_back(cacheAvailable ? msgs.push_back(cacheAvailable ?
CStatusMessage(this, CStatusMessage::SeverityInfo, "Cache only setup, using it as it is") : CStatusMessage(this, CStatusMessage::SeverityInfo, "Cache only setup, using it as it is") :
CStatusMessage(this, CStatusMessage::SeverityError, "Cache only setup, but cache is empty") CStatusMessage(this, CStatusMessage::SeverityError, "Cache only setup, but cache is empty")
@@ -227,14 +227,12 @@ namespace BlackCore
void CSetupReader::ps_readUpdateInfo() void CSetupReader::ps_readUpdateInfo()
{ {
// const CUrl url(this->m_updateInfoUrls.obtainNextWorkingUrl()); const CUrl url(this->m_distributionUrls.obtainNextWorkingUrl());
const CUrl url("https://datastore.swift-project.org/shared/0.7.0/updateinfo/updateinfo2.json");
if (url.isEmpty()) if (url.isEmpty())
{ {
CLogMessage(this).warning("Cannot read update info, URLs: %1, failed URLs: %2") CLogMessage(this).warning("Cannot read update info, URLs: %1, failed URLs: %2")
<< this->m_updateInfoUrls << this->m_distributionUrls
<< this->m_updateInfoUrls.getFailedUrls(); << this->m_distributionUrls.getFailedUrls();
this->manageDistributionsInfoAvailability(false); this->manageDistributionsInfoAvailability(false);
return; return;
} }
@@ -330,7 +328,7 @@ namespace BlackCore
bool sameVersionLoaded = (loadedSetup == currentSetup); bool sameVersionLoaded = (loadedSetup == currentSetup);
if (sameVersionLoaded) if (sameVersionLoaded)
{ {
this->m_updateInfoUrls = currentSetup.getUpdateInfoFileUrls(); // defaults this->m_distributionUrls = currentSetup.getDistributionUrls(); // defaults
CLogMessage(this).info("Same setup version loaded from %1 as already in data cache %2") << urlString << m_setup.getFilename(); CLogMessage(this).info("Same setup version loaded from %1 as already in data cache %2") << urlString << m_setup.getFilename();
CLogMessage::preformatted(this->manageSetupAvailability(true)); CLogMessage::preformatted(this->manageSetupAvailability(true));
return; // success return; // success
@@ -343,7 +341,7 @@ namespace BlackCore
if (m.isSeverityInfoOrLess()) if (m.isSeverityInfoOrLess())
{ {
// no issue with cache // no issue with cache
this->m_updateInfoUrls = loadedSetup.getUpdateInfoFileUrls(); this->m_distributionUrls = loadedSetup.getDistributionUrls();
CLogMessage(this).info("Setup: Updated data cache in '%1'") << this->m_setup.getFilename(); CLogMessage(this).info("Setup: Updated data cache in '%1'") << this->m_setup.getFilename();
} }
CLogMessage::preformatted(this->manageSetupAvailability(true)); CLogMessage::preformatted(this->manageSetupAvailability(true));
@@ -457,7 +455,7 @@ namespace BlackCore
} }
// try next one if any // try next one if any
if (this->m_updateInfoUrls.addFailedUrl(url)) if (this->m_distributionUrls.addFailedUrl(url))
{ {
QTimer::singleShot(500, this, &CSetupReader::ps_readUpdateInfo); QTimer::singleShot(500, this, &CSetupReader::ps_readUpdateInfo);
} }

View File

@@ -134,7 +134,7 @@ namespace BlackCore
QString m_bootstrapUrlFileValue; //! Bootstrap URL if not local QString m_bootstrapUrlFileValue; //! Bootstrap URL if not local
BootstrapMode m_bootstrapMode = Explicit; //! How to bootstrap BootstrapMode m_bootstrapMode = Explicit; //! How to bootstrap
BlackMisc::Network::CFailoverUrlList m_bootstrapUrls; //!< location of setup files BlackMisc::Network::CFailoverUrlList m_bootstrapUrls; //!< location of setup files
BlackMisc::Network::CFailoverUrlList m_updateInfoUrls; //!< location of info files BlackMisc::Network::CFailoverUrlList m_distributionUrls; //!< location of info files
QCommandLineOption m_cmdBootstrapUrl; //!< bootstrap URL QCommandLineOption m_cmdBootstrapUrl; //!< bootstrap URL
QCommandLineOption m_cmdBootstrapMode; //!< bootstrap mode QCommandLineOption m_cmdBootstrapMode; //!< bootstrap mode
mutable QReadWriteLock m_lockSetup; //!< lock for setup mutable QReadWriteLock m_lockSetup; //!< lock for setup