mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
Ref T29, utility function added and flag names adjusted
This commit is contained in:
committed by
Mathew Sutcliffe
parent
224c61c7e9
commit
9e4cfca2cc
@@ -214,7 +214,7 @@ namespace BlackCore
|
||||
CDatabaseReaderConfigList CDatabaseReaderConfigList::forPilotClient()
|
||||
{
|
||||
const CTime cacheLifetime(30.0, CTimeUnit::d());
|
||||
const CDbFlags::DataRetrievalMode retrievalFlags = CDbFlags::CacheAndSharedHeaders;
|
||||
const CDbFlags::DataRetrievalMode retrievalFlags = CDbFlags::CacheAndSharedInfo;
|
||||
CDbFlags::DataRetrievalMode retrievalFlagsWriting = retrievalFlags;
|
||||
retrievalFlagsWriting |= CDbFlags::DbWriting;
|
||||
|
||||
|
||||
@@ -51,6 +51,19 @@ namespace BlackMisc
|
||||
return list.join(',');
|
||||
}
|
||||
|
||||
CDbFlags::DataRetrievalModeFlag CDbFlags::modeToModeFlag(DataRetrievalMode mode)
|
||||
{
|
||||
if (mode == Unspecified) return Unspecified;
|
||||
if (mode == DbReading) return DbReading;
|
||||
if (mode == DbWriting) return DbWriting;
|
||||
if (mode == Shared) return Shared;
|
||||
if (mode == SharedInfoOnly) return SharedInfoOnly;
|
||||
if (mode == Cached) return Cached;
|
||||
if (mode == Canceled) return Canceled;
|
||||
if (mode == Ignore) return Ignore;
|
||||
return Unspecified;
|
||||
}
|
||||
|
||||
CDbFlags::DataRetrievalMode CDbFlags::adjustWhenDbIsDown(DataRetrievalMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace BlackMisc
|
||||
namespace Db
|
||||
{
|
||||
/*!
|
||||
* What and state of reading from web services
|
||||
* What and how to read web services
|
||||
*/
|
||||
class BLACKMISC_EXPORT CDbFlags
|
||||
{
|
||||
@@ -31,17 +31,19 @@ namespace BlackMisc
|
||||
//! Which data to read, requires corresponding readers
|
||||
enum DataRetrievalModeFlag
|
||||
{
|
||||
Unspecified = 0, //!< Unspecified
|
||||
DbReading = 1 << 0, //!< directly from DB
|
||||
DbWriting = 1 << 1, //!< DB writing
|
||||
Shared = 1 << 2, //!< shared directory
|
||||
SharedInfoOnly = 1 << 3, //!< shared info file only
|
||||
Cached = 1 << 4, //!< from cache
|
||||
Canceled = 1 << 5, //!< canceled DB reading
|
||||
Ignore = 1 << 6, //!< ignore this entity
|
||||
CacheThenDb = DbReading | Cached, //!< Cache where possible, otherwise DB
|
||||
CacheThenShared = Shared | Cached, //!< Cache where possible, otherwise shared
|
||||
CacheAndSharedHeaders = SharedInfoOnly | Cached
|
||||
Unspecified = 0, //!< Unspecified
|
||||
DbReading = 1 << 0, //!< directly from DB
|
||||
DbWriting = 1 << 1, //!< DB writing
|
||||
Shared = 1 << 2, //!< shared directory
|
||||
SharedInfoOnly = 1 << 3, //!< shared info file only
|
||||
Cached = 1 << 4, //!< from cache
|
||||
Canceled = 1 << 5, //!< canceled DB reading
|
||||
Ignore = 1 << 6, //!< ignore this entity
|
||||
CacheThenDb = DbReading | Cached, //!< Cache where possible, otherwise DB
|
||||
CacheThenShared = Shared | Cached, //!< Cache where possible, otherwise shared
|
||||
CacheAndSharedInfo = SharedInfoOnly | Cached, //!< Cached data plus shared info file
|
||||
DbReadingOrShared = DbReading | Shared, //!< read from DB or shared
|
||||
DbReadingOrAnyShared = DbReading | Shared | SharedInfoOnly //!< read from DB or shared/shared info
|
||||
};
|
||||
Q_DECLARE_FLAGS(DataRetrievalMode, DataRetrievalModeFlag)
|
||||
|
||||
@@ -54,6 +56,10 @@ namespace BlackMisc
|
||||
//! Convert to string
|
||||
static QString flagToString(CDbFlags::DataRetrievalMode mode);
|
||||
|
||||
//! Mode to flag
|
||||
//! \remark any combination results in Unspecified, only single flags are returned
|
||||
static DataRetrievalModeFlag modeToModeFlag(DataRetrievalMode mode);
|
||||
|
||||
//! Adjust flag as we already know DB is down
|
||||
static DataRetrievalMode adjustWhenDbIsDown(DataRetrievalMode mode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user