From 5327f6d0324a76669a90f31e593613f0fc2d956d Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 10 Dec 2015 14:43:29 +0100 Subject: Added resource disk usage --- common/genericresource.cpp | 10 ++++++++++ common/genericresource.h | 1 + 2 files changed, 11 insertions(+) (limited to 'common') 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 GenericResource::replay(const QByteArray &type, const QByteArr void GenericResource::removeFromDisk(const QByteArray &instanceIdentifier) { + Warning() << "Removing from generic resource"; Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier, Akonadi2::Storage::ReadWrite).removeFromDisk(); Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".userqueue", Akonadi2::Storage::ReadWrite).removeFromDisk(); Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".synchronizerqueue", Akonadi2::Storage::ReadWrite).removeFromDisk(); Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".changereplay", Akonadi2::Storage::ReadWrite).removeFromDisk(); } +qint64 GenericResource::diskUsage(const QByteArray &instanceIdentifier) +{ + auto size = Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier, Akonadi2::Storage::ReadOnly).diskUsage(); + size += Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".userqueue", Akonadi2::Storage::ReadOnly).diskUsage(); + size += Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".synchronizerqueue", Akonadi2::Storage::ReadOnly).diskUsage(); + size += Akonadi2::Storage(Akonadi2::storageLocation(), instanceIdentifier + ".changereplay", Akonadi2::Storage::ReadOnly).diskUsage(); + return size; +} + void GenericResource::onProcessorError(int errorCode, const QString &errorMessage) { 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: int error() const; static void removeFromDisk(const QByteArray &instanceIdentifier); + static qint64 diskUsage(const QByteArray &instanceIdentifier); private Q_SLOTS: void updateLowerBoundRevision(); -- cgit v1.2.3