diff options
-rw-r--r-- | common/genericresource.cpp | 10 | ||||
-rw-r--r-- | common/genericresource.h | 1 | ||||
-rw-r--r-- | tests/dummyresourcebenchmark.cpp | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp index 7b8d9bb..3655a63 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp | |||
@@ -292,12 +292,22 @@ KAsync::Job<void> GenericResource::replay(const QByteArray &type, const QByteArr | |||
292 | 292 | ||
293 | void GenericResource::removeFromDisk(const QByteArray &instanceIdentifier) | 293 | void GenericResource::removeFromDisk(const QByteArray &instanceIdentifier) |
294 | { | 294 | { |
295 | Warning() << "Removing from generic resource"; | ||
295 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier, Akonadi2::Storage::ReadWrite).removeFromDisk(); | 296 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier, Akonadi2::Storage::ReadWrite).removeFromDisk(); |
296 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".userqueue", Akonadi2::Storage::ReadWrite).removeFromDisk(); | 297 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".userqueue", Akonadi2::Storage::ReadWrite).removeFromDisk(); |
297 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".synchronizerqueue", Akonadi2::Storage::ReadWrite).removeFromDisk(); | 298 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".synchronizerqueue", Akonadi2::Storage::ReadWrite).removeFromDisk(); |
298 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".changereplay", Akonadi2::Storage::ReadWrite).removeFromDisk(); | 299 | Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".changereplay", Akonadi2::Storage::ReadWrite).removeFromDisk(); |
299 | } | 300 | } |
300 | 301 | ||
302 | qint64 GenericResource::diskUsage(const QByteArray &instanceIdentifier) | ||
303 | { | ||
304 | auto size = Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier, Akonadi2::Storage::ReadOnly).diskUsage(); | ||
305 | size += Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".userqueue", Akonadi2::Storage::ReadOnly).diskUsage(); | ||
306 | size += Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".synchronizerqueue", Akonadi2::Storage::ReadOnly).diskUsage(); | ||
307 | size += Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".changereplay", Akonadi2::Storage::ReadOnly).diskUsage(); | ||
308 | return size; | ||
309 | } | ||
310 | |||
301 | void GenericResource::onProcessorError(int errorCode, const QString &errorMessage) | 311 | void GenericResource::onProcessorError(int errorCode, const QString &errorMessage) |
302 | { | 312 | { |
303 | Warning() << "Received error from Processor: " << errorCode << errorMessage; | 313 | Warning() << "Received error from Processor: " << errorCode << errorMessage; |
diff --git a/common/genericresource.h b/common/genericresource.h index 97251a9..f756273 100644 --- a/common/genericresource.h +++ b/common/genericresource.h | |||
@@ -49,6 +49,7 @@ public: | |||
49 | int error() const; | 49 | int error() const; |
50 | 50 | ||
51 | static void removeFromDisk(const QByteArray &instanceIdentifier); | 51 | static void removeFromDisk(const QByteArray &instanceIdentifier); |
52 | static qint64 diskUsage(const QByteArray &instanceIdentifier); | ||
52 | private Q_SLOTS: | 53 | private Q_SLOTS: |
53 | void updateLowerBoundRevision(); | 54 | void updateLowerBoundRevision(); |
54 | 55 | ||
diff --git a/tests/dummyresourcebenchmark.cpp b/tests/dummyresourcebenchmark.cpp index ae15b9c..25fb96b 100644 --- a/tests/dummyresourcebenchmark.cpp +++ b/tests/dummyresourcebenchmark.cpp | |||
@@ -106,6 +106,9 @@ private Q_SLOTS: | |||
106 | row.setValue("total", (qreal)num/allProcessedTime); | 106 | row.setValue("total", (qreal)num/allProcessedTime); |
107 | dataset.insertRow(row); | 107 | dataset.insertRow(row); |
108 | HAWD::Formatter::print(dataset); | 108 | HAWD::Formatter::print(dataset); |
109 | |||
110 | auto diskUsage = DummyResource::diskUsage("org.kde.dummy.instance1"); | ||
111 | qDebug() << "Database size [kb]: " << diskUsage/1024; | ||
109 | } | 112 | } |
110 | 113 | ||
111 | void testQueryByUid() | 114 | void testQueryByUid() |