diff options
Diffstat (limited to 'common/storage.h')
-rw-r--r-- | common/storage.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/common/storage.h b/common/storage.h index 2d34f1f..ac03947 100644 --- a/common/storage.h +++ b/common/storage.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #pragma once | 22 | #pragma once |
23 | 23 | ||
24 | #include <sinkcommon_export.h> | 24 | #include "sink_export.h" |
25 | #include <string> | 25 | #include <string> |
26 | #include <functional> | 26 | #include <functional> |
27 | #include <QString> | 27 | #include <QString> |
@@ -29,7 +29,7 @@ | |||
29 | namespace Sink | 29 | namespace Sink |
30 | { | 30 | { |
31 | 31 | ||
32 | class SINKCOMMON_EXPORT Storage { | 32 | class SINK_EXPORT Storage { |
33 | public: | 33 | public: |
34 | enum AccessMode { ReadOnly, ReadWrite }; | 34 | enum AccessMode { ReadOnly, ReadWrite }; |
35 | 35 | ||
@@ -180,6 +180,13 @@ public: | |||
180 | qint64 diskUsage() const; | 180 | qint64 diskUsage() const; |
181 | void removeFromDisk() const; | 181 | void removeFromDisk() const; |
182 | 182 | ||
183 | /** | ||
184 | * Clears all cached environments. | ||
185 | * | ||
186 | * This only ever has to be called if a database was removed from another process. | ||
187 | */ | ||
188 | static void clearEnv(); | ||
189 | |||
183 | static qint64 maxRevision(const Sink::Storage::Transaction &); | 190 | static qint64 maxRevision(const Sink::Storage::Transaction &); |
184 | static void setMaxRevision(Sink::Storage::Transaction &, qint64 revision); | 191 | static void setMaxRevision(Sink::Storage::Transaction &, qint64 revision); |
185 | 192 | ||
@@ -200,6 +207,8 @@ public: | |||
200 | static QByteArray assembleKey(const QByteArray &key, qint64 revision); | 207 | static QByteArray assembleKey(const QByteArray &key, qint64 revision); |
201 | static QByteArray uidFromKey(const QByteArray &key); | 208 | static QByteArray uidFromKey(const QByteArray &key); |
202 | 209 | ||
210 | static NamedDatabase mainDatabase(const Sink::Storage::Transaction &, const QByteArray &type); | ||
211 | |||
203 | private: | 212 | private: |
204 | std::function<void(const Storage::Error &error)> mErrorHandler; | 213 | std::function<void(const Storage::Error &error)> mErrorHandler; |
205 | 214 | ||