mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
Some Web readers adjustemnts
* do not init shared URLs before needed * do not load info objects when DB is unavailable * adjust reader flags when DB is down * airport URL available in setup
This commit is contained in:
@@ -40,12 +40,24 @@ namespace BlackMisc
|
||||
{
|
||||
QStringList list;
|
||||
if (mode.testFlag(Unspecified)) list << "Unspecified";
|
||||
if (mode.testFlag(Canceled)) list << "Unspecified";
|
||||
|
||||
if (mode.testFlag(DbDirect)) list << "Direct DB access";
|
||||
if (mode.testFlag(Shared)) list << "Shared data";
|
||||
if (mode.testFlag(Cached)) list << "Cached data";
|
||||
return list.join(',');
|
||||
}
|
||||
|
||||
CDbFlags::DataRetrievalMode CDbFlags::adjustWhenDbIsDown(DataRetrievalMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case DbDirect: return Canceled;
|
||||
case CacheThenDb: return Cached;
|
||||
default: return mode;
|
||||
}
|
||||
}
|
||||
|
||||
void CDbFlags::registerMetadata()
|
||||
{
|
||||
// this is no value class and I register enums here,
|
||||
|
||||
@@ -35,10 +35,10 @@ namespace BlackMisc
|
||||
DbDirect = 1 << 0, //!< directly from DB
|
||||
Shared = 1 << 1, //!< shared directory
|
||||
Cached = 1 << 2, //!< from cache
|
||||
DbFailover = 1 << 3, //!< read from DB if cache (and only if) cache is empty
|
||||
SharedFailover = 1 << 4, //!< read shared if cache (and only if) cache is empty
|
||||
Canceled = 1 << 3, //!< cancel DB reading
|
||||
CacheThenDb = DbDirect | Cached, //!< Cache when possible, otherwise DB
|
||||
CacheThenShared = Shared | Cached //!< Cache when possible, otherwise shared
|
||||
|
||||
};
|
||||
Q_DECLARE_FLAGS(DataRetrievalMode, DataRetrievalModeFlag)
|
||||
|
||||
@@ -51,6 +51,9 @@ namespace BlackMisc
|
||||
//! Convert to string
|
||||
static QString flagToString(CDbFlags::DataRetrievalMode mode);
|
||||
|
||||
//! Adjust flag as we alread know DB is down
|
||||
static DataRetrievalMode adjustWhenDbIsDown(DataRetrievalMode mode);
|
||||
|
||||
//! Register metadata
|
||||
static void registerMetadata();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user