mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #921, changed setup/reader to distribution URL
This commit is contained in:
committed by
Mathew Sutcliffe
parent
10c8f7c50a
commit
9faad01c8b
@@ -155,10 +155,10 @@ namespace BlackCore
|
||||
return setup;
|
||||
}
|
||||
|
||||
CUrlList CGlobalSetup::getUpdateInfoFileUrls() const
|
||||
CUrlList CGlobalSetup::getDistributionUrls() const
|
||||
{
|
||||
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
|
||||
@@ -194,8 +194,8 @@ namespace BlackCore
|
||||
s.append(boolToYesNo(isDevelopment()));
|
||||
s.append(separator);
|
||||
|
||||
s.append("Update info URLs: ");
|
||||
s.append(getUpdateInfoFileUrls().toQString(i18n));
|
||||
s.append("Distribution URLs: ");
|
||||
s.append(getDistributionUrls().toQString(i18n));
|
||||
s.append(separator);
|
||||
s.append("Bootstrap URLs: ");
|
||||
s.append(getBootstrapFileUrls().toQString(i18n));
|
||||
@@ -270,7 +270,7 @@ namespace BlackCore
|
||||
case IndexVatsimMetars:
|
||||
return CVariant::fromValue(this->m_vatsimMetarsUrls);
|
||||
case IndexUpdateInfo:
|
||||
return CVariant::fromValue(this->getUpdateInfoFileUrls());
|
||||
return CVariant::fromValue(this->getDistributionUrls());
|
||||
case IndexBootstrapFileUrls:
|
||||
return CVariant::fromValue(this->getBootstrapFileUrls());
|
||||
case IndexSwiftDbFiles:
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace BlackCore
|
||||
BlackMisc::Network::CUrlList getBootstrapFileUrls() const;
|
||||
|
||||
//! Version and download locations
|
||||
BlackMisc::Network::CUrlList getUpdateInfoFileUrls() const;
|
||||
BlackMisc::Network::CUrlList getDistributionUrls() const;
|
||||
|
||||
//! Alternative locations of swift DB data files
|
||||
BlackMisc::Network::CUrlList getSwiftDbDataFileLocationUrls() const;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace BlackCore
|
||||
);
|
||||
if (this->m_bootstrapMode == CacheOnly)
|
||||
{
|
||||
this->m_updateInfoUrls = cachedSetup.getUpdateInfoFileUrls();
|
||||
this->m_distributionUrls = cachedSetup.getDistributionUrls();
|
||||
msgs.push_back(cacheAvailable ?
|
||||
CStatusMessage(this, CStatusMessage::SeverityInfo, "Cache only setup, using it as it is") :
|
||||
CStatusMessage(this, CStatusMessage::SeverityError, "Cache only setup, but cache is empty")
|
||||
@@ -227,14 +227,12 @@ namespace BlackCore
|
||||
|
||||
void CSetupReader::ps_readUpdateInfo()
|
||||
{
|
||||
// const CUrl url(this->m_updateInfoUrls.obtainNextWorkingUrl());
|
||||
|
||||
const CUrl url("https://datastore.swift-project.org/shared/0.7.0/updateinfo/updateinfo2.json");
|
||||
const CUrl url(this->m_distributionUrls.obtainNextWorkingUrl());
|
||||
if (url.isEmpty())
|
||||
{
|
||||
CLogMessage(this).warning("Cannot read update info, URLs: %1, failed URLs: %2")
|
||||
<< this->m_updateInfoUrls
|
||||
<< this->m_updateInfoUrls.getFailedUrls();
|
||||
<< this->m_distributionUrls
|
||||
<< this->m_distributionUrls.getFailedUrls();
|
||||
this->manageDistributionsInfoAvailability(false);
|
||||
return;
|
||||
}
|
||||
@@ -330,7 +328,7 @@ namespace BlackCore
|
||||
bool sameVersionLoaded = (loadedSetup == currentSetup);
|
||||
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::preformatted(this->manageSetupAvailability(true));
|
||||
return; // success
|
||||
@@ -343,7 +341,7 @@ namespace BlackCore
|
||||
if (m.isSeverityInfoOrLess())
|
||||
{
|
||||
// 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::preformatted(this->manageSetupAvailability(true));
|
||||
@@ -457,7 +455,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
// try next one if any
|
||||
if (this->m_updateInfoUrls.addFailedUrl(url))
|
||||
if (this->m_distributionUrls.addFailedUrl(url))
|
||||
{
|
||||
QTimer::singleShot(500, this, &CSetupReader::ps_readUpdateInfo);
|
||||
}
|
||||
|
||||
@@ -130,15 +130,15 @@ namespace BlackCore
|
||||
bool m_shutdown = false;
|
||||
std::atomic<bool> m_setupAvailable { false };
|
||||
std::atomic<bool> m_distributionInfoAvailable { false };
|
||||
QString m_localSetupFileValue; //! Local file for setup, passed by cmd line arguments
|
||||
QString m_bootstrapUrlFileValue; //! Bootstrap URL if not local
|
||||
BootstrapMode m_bootstrapMode = Explicit; //! How to bootstrap
|
||||
BlackMisc::Network::CFailoverUrlList m_bootstrapUrls; //!< location of setup files
|
||||
BlackMisc::Network::CFailoverUrlList m_updateInfoUrls; //!< location of info files
|
||||
QCommandLineOption m_cmdBootstrapUrl; //!< bootstrap URL
|
||||
QCommandLineOption m_cmdBootstrapMode; //!< bootstrap mode
|
||||
mutable QReadWriteLock m_lockSetup; //!< lock for setup
|
||||
BlackMisc::CStatusMessageList m_setupReadErrorMsgs; //!< last parsing error messages
|
||||
QString m_localSetupFileValue; //! Local file for setup, passed by cmd line arguments
|
||||
QString m_bootstrapUrlFileValue; //! Bootstrap URL if not local
|
||||
BootstrapMode m_bootstrapMode = Explicit; //! How to bootstrap
|
||||
BlackMisc::Network::CFailoverUrlList m_bootstrapUrls; //!< location of setup files
|
||||
BlackMisc::Network::CFailoverUrlList m_distributionUrls; //!< location of info files
|
||||
QCommandLineOption m_cmdBootstrapUrl; //!< bootstrap URL
|
||||
QCommandLineOption m_cmdBootstrapMode; //!< bootstrap mode
|
||||
mutable QReadWriteLock m_lockSetup; //!< lock for setup
|
||||
BlackMisc::CStatusMessageList m_setupReadErrorMsgs; //!< last parsing error messages
|
||||
BlackMisc::CData<BlackCore::Data::TGlobalSetup> m_setup {this, &CSetupReader::ps_setupChanged}; //!< data cache setup
|
||||
BlackMisc::CData<BlackMisc::Db::TDistributionInfo> m_distributions {this}; //!< data cache distributions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user