diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-07-26 22:36:44 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-07-28 15:46:16 +0200 |
commit | ed1b034089dfc1948acaa80a5200cb0df28d0c1c (patch) | |
tree | 5b462d21e2b1de16bcd48e98d8875f1eb07bfb6b /lib | |
parent | eed5a6f127ec3bb1553ac629457f196d8893665a (diff) | |
download | libquotient-ed1b034089dfc1948acaa80a5200cb0df28d0c1c.tar.gz libquotient-ed1b034089dfc1948acaa80a5200cb0df28d0c1c.zip |
SyncData: minor update to the cache version
The minor component is now updated in .cpp, not in .h.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/syncdata.cpp | 7 | ||||
-rw-r--r-- | lib/syncdata.h | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/syncdata.cpp b/lib/syncdata.cpp index d3c270b5..3e0eff17 100644 --- a/lib/syncdata.cpp +++ b/lib/syncdata.cpp @@ -103,7 +103,7 @@ SyncData::SyncData(const QString& cacheFileName) { QFileInfo cacheFileInfo { cacheFileName }; auto json = loadJson(cacheFileName); - auto requiredVersion = std::get<0>(cacheVersion()); + auto requiredVersion = MajorCacheVersion; auto actualVersion = json.value("cache_version"_ls).toObject().value("major"_ls).toInt(); if (actualVersion == requiredVersion) @@ -128,6 +128,11 @@ Events&& SyncData::takeAccountData() { return std::move(accountData); } Events&& SyncData::takeToDeviceEvents() { return std::move(toDeviceEvents); } +std::pair<int, int> SyncData::cacheVersion() +{ + return { MajorCacheVersion, 1 }; +} + QJsonObject SyncData::loadJson(const QString& fileName) { QFile roomFile { fileName }; diff --git a/lib/syncdata.h b/lib/syncdata.h index b0e31726..b869a541 100644 --- a/lib/syncdata.h +++ b/lib/syncdata.h @@ -87,7 +87,8 @@ public: QStringList unresolvedRooms() const { return unresolvedRoomIds; } - static std::pair<int, int> cacheVersion() { return { 11, 0 }; } + static constexpr int MajorCacheVersion = 11; + static std::pair<int, int> cacheVersion(); static QString fileNameForRoom(QString roomId); private: |