diff options
-rw-r--r-- | common/genericresource.cpp | 10 | ||||
-rw-r--r-- | common/genericresource.h | 1 | ||||
-rw-r--r-- | common/listener.cpp | 5 | ||||
-rw-r--r-- | common/resource.cpp | 4 | ||||
-rw-r--r-- | common/resource.h | 6 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.cpp | 4 | ||||
-rw-r--r-- | examples/dummyresource/resourcefactory.h | 1 | ||||
-rw-r--r-- | examples/imapresource/imapresource.cpp | 5 | ||||
-rw-r--r-- | examples/imapresource/imapresource.h | 1 | ||||
-rw-r--r-- | examples/maildirresource/maildirresource.cpp | 5 | ||||
-rw-r--r-- | examples/maildirresource/maildirresource.h | 1 | ||||
-rw-r--r-- | examples/mailtransportresource/mailtransportresource.cpp | 5 | ||||
-rw-r--r-- | examples/mailtransportresource/mailtransportresource.h | 1 |
13 files changed, 28 insertions, 21 deletions
diff --git a/common/genericresource.cpp b/common/genericresource.cpp index f5b1775..ef6edc8 100644 --- a/common/genericresource.cpp +++ b/common/genericresource.cpp | |||
@@ -355,16 +355,6 @@ void GenericResource::setupChangereplay(const QSharedPointer<ChangeReplay> &chan | |||
355 | enableChangeReplay(true); | 355 | enableChangeReplay(true); |
356 | } | 356 | } |
357 | 357 | ||
358 | void GenericResource::removeDataFromDisk() | ||
359 | { | ||
360 | SinkLog() << "Removing the resource from disk: " << mResourceInstanceIdentifier; | ||
361 | //Ensure we have no transaction or databases open | ||
362 | mSynchronizer.clear(); | ||
363 | mChangeReplay.clear(); | ||
364 | mPipeline.clear(); | ||
365 | removeFromDisk(mResourceInstanceIdentifier); | ||
366 | } | ||
367 | |||
368 | void GenericResource::removeFromDisk(const QByteArray &instanceIdentifier) | 358 | void GenericResource::removeFromDisk(const QByteArray &instanceIdentifier) |
369 | { | 359 | { |
370 | Sink::Storage(Sink::storageLocation(), instanceIdentifier, Sink::Storage::ReadWrite).removeFromDisk(); | 360 | Sink::Storage(Sink::storageLocation(), instanceIdentifier, Sink::Storage::ReadWrite).removeFromDisk(); |
diff --git a/common/genericresource.h b/common/genericresource.h index 97132c2..ec43939 100644 --- a/common/genericresource.h +++ b/common/genericresource.h | |||
@@ -55,7 +55,6 @@ public: | |||
55 | 55 | ||
56 | int error() const; | 56 | int error() const; |
57 | 57 | ||
58 | void removeDataFromDisk() Q_DECL_OVERRIDE; | ||
59 | static void removeFromDisk(const QByteArray &instanceIdentifier); | 58 | static void removeFromDisk(const QByteArray &instanceIdentifier); |
60 | static qint64 diskUsage(const QByteArray &instanceIdentifier); | 59 | static qint64 diskUsage(const QByteArray &instanceIdentifier); |
61 | 60 | ||
diff --git a/common/listener.cpp b/common/listener.cpp index db9b21b..1a8f392 100644 --- a/common/listener.cpp +++ b/common/listener.cpp | |||
@@ -294,8 +294,11 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c | |||
294 | } break; | 294 | } break; |
295 | case Sink::Commands::RemoveFromDiskCommand: { | 295 | case Sink::Commands::RemoveFromDiskCommand: { |
296 | SinkLog() << QString("Received a remove from disk command from %1").arg(client.name); | 296 | SinkLog() << QString("Received a remove from disk command from %1").arg(client.name); |
297 | //Close the resource to ensure no transactions are open | ||
297 | m_resource.reset(nullptr); | 298 | m_resource.reset(nullptr); |
298 | loadResource().removeDataFromDisk(); | 299 | if (Sink::ResourceFactory *resourceFactory = Sink::ResourceFactory::load(m_resourceName)) { |
300 | resourceFactory->removeDataFromDisk(m_resourceInstanceIdentifier); | ||
301 | } | ||
299 | m_exiting = true; | 302 | m_exiting = true; |
300 | } break; | 303 | } break; |
301 | default: | 304 | default: |
diff --git a/common/resource.cpp b/common/resource.cpp index 82c9fc8..f4c2ad4 100644 --- a/common/resource.cpp +++ b/common/resource.cpp | |||
@@ -61,10 +61,6 @@ void Resource::setLowerBoundRevision(qint64 revision) | |||
61 | Q_UNUSED(revision) | 61 | Q_UNUSED(revision) |
62 | } | 62 | } |
63 | 63 | ||
64 | void Resource::removeDataFromDisk() | ||
65 | { | ||
66 | } | ||
67 | |||
68 | 64 | ||
69 | class ResourceFactory::Private | 65 | class ResourceFactory::Private |
70 | { | 66 | { |
diff --git a/common/resource.h b/common/resource.h index 1c35838..d468aca 100644 --- a/common/resource.h +++ b/common/resource.h | |||
@@ -55,11 +55,6 @@ public: | |||
55 | */ | 55 | */ |
56 | virtual void setLowerBoundRevision(qint64 revision); | 56 | virtual void setLowerBoundRevision(qint64 revision); |
57 | 57 | ||
58 | /** | ||
59 | * Remove the data from disk | ||
60 | */ | ||
61 | virtual void removeDataFromDisk(); | ||
62 | |||
63 | signals: | 58 | signals: |
64 | void revisionUpdated(qint64); | 59 | void revisionUpdated(qint64); |
65 | void notify(Notification); | 60 | void notify(Notification); |
@@ -83,6 +78,7 @@ public: | |||
83 | virtual Resource *createResource(const QByteArray &instanceIdentifier) = 0; | 78 | virtual Resource *createResource(const QByteArray &instanceIdentifier) = 0; |
84 | virtual void registerFacades(FacadeFactory &factory) = 0; | 79 | virtual void registerFacades(FacadeFactory &factory) = 0; |
85 | virtual void registerAdaptorFactories(AdaptorFactoryRegistry ®istry) {}; | 80 | virtual void registerAdaptorFactories(AdaptorFactoryRegistry ®istry) {}; |
81 | virtual void removeDataFromDisk(const QByteArray &instanceIdentifier) = 0; | ||
86 | 82 | ||
87 | private: | 83 | private: |
88 | class Private; | 84 | class Private; |
diff --git a/examples/dummyresource/resourcefactory.cpp b/examples/dummyresource/resourcefactory.cpp index 221e20d..6d14721 100644 --- a/examples/dummyresource/resourcefactory.cpp +++ b/examples/dummyresource/resourcefactory.cpp | |||
@@ -201,3 +201,7 @@ void DummyResourceFactory::registerAdaptorFactories(Sink::AdaptorFactoryRegistry | |||
201 | registry.registerFactory<Sink::ApplicationDomain::Event, DummyEventAdaptorFactory>(PLUGIN_NAME); | 201 | registry.registerFactory<Sink::ApplicationDomain::Event, DummyEventAdaptorFactory>(PLUGIN_NAME); |
202 | } | 202 | } |
203 | 203 | ||
204 | void DummyResourceFactory::removeDataFromDisk(const QByteArray &instanceIdentifier) | ||
205 | { | ||
206 | DummyResource::removeFromDisk(instanceIdentifier); | ||
207 | } | ||
diff --git a/examples/dummyresource/resourcefactory.h b/examples/dummyresource/resourcefactory.h index 9192c68..0a29d53 100644 --- a/examples/dummyresource/resourcefactory.h +++ b/examples/dummyresource/resourcefactory.h | |||
@@ -51,5 +51,6 @@ public: | |||
51 | Sink::Resource *createResource(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; | 51 | Sink::Resource *createResource(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; |
52 | void registerFacades(Sink::FacadeFactory &factory) Q_DECL_OVERRIDE; | 52 | void registerFacades(Sink::FacadeFactory &factory) Q_DECL_OVERRIDE; |
53 | void registerAdaptorFactories(Sink::AdaptorFactoryRegistry ®istry) Q_DECL_OVERRIDE; | 53 | void registerAdaptorFactories(Sink::AdaptorFactoryRegistry ®istry) Q_DECL_OVERRIDE; |
54 | void removeDataFromDisk(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; | ||
54 | }; | 55 | }; |
55 | 56 | ||
diff --git a/examples/imapresource/imapresource.cpp b/examples/imapresource/imapresource.cpp index aa0fb94..c72579c 100644 --- a/examples/imapresource/imapresource.cpp +++ b/examples/imapresource/imapresource.cpp | |||
@@ -714,3 +714,8 @@ void ImapResourceFactory::registerAdaptorFactories(Sink::AdaptorFactoryRegistry | |||
714 | registry.registerFactory<Sink::ApplicationDomain::Mail, ImapMailAdaptorFactory>(PLUGIN_NAME); | 714 | registry.registerFactory<Sink::ApplicationDomain::Mail, ImapMailAdaptorFactory>(PLUGIN_NAME); |
715 | registry.registerFactory<Sink::ApplicationDomain::Folder, ImapFolderAdaptorFactory>(PLUGIN_NAME); | 715 | registry.registerFactory<Sink::ApplicationDomain::Folder, ImapFolderAdaptorFactory>(PLUGIN_NAME); |
716 | } | 716 | } |
717 | |||
718 | void ImapResourceFactory::removeDataFromDisk(const QByteArray &instanceIdentifier) | ||
719 | { | ||
720 | ImapResource::removeFromDisk(instanceIdentifier); | ||
721 | } | ||
diff --git a/examples/imapresource/imapresource.h b/examples/imapresource/imapresource.h index 534a04e..236e695 100644 --- a/examples/imapresource/imapresource.h +++ b/examples/imapresource/imapresource.h | |||
@@ -65,5 +65,6 @@ public: | |||
65 | Sink::Resource *createResource(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; | 65 | Sink::Resource *createResource(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; |
66 | void registerFacades(Sink::FacadeFactory &factory) Q_DECL_OVERRIDE; | 66 | void registerFacades(Sink::FacadeFactory &factory) Q_DECL_OVERRIDE; |
67 | void registerAdaptorFactories(Sink::AdaptorFactoryRegistry ®istry) Q_DECL_OVERRIDE; | 67 | void registerAdaptorFactories(Sink::AdaptorFactoryRegistry ®istry) Q_DECL_OVERRIDE; |
68 | void removeDataFromDisk(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; | ||
68 | }; | 69 | }; |
69 | 70 | ||
diff --git a/examples/maildirresource/maildirresource.cpp b/examples/maildirresource/maildirresource.cpp index e69d822..1ed7fc8 100644 --- a/examples/maildirresource/maildirresource.cpp +++ b/examples/maildirresource/maildirresource.cpp | |||
@@ -594,3 +594,8 @@ void MaildirResourceFactory::registerAdaptorFactories(Sink::AdaptorFactoryRegist | |||
594 | registry.registerFactory<Sink::ApplicationDomain::Folder, MaildirFolderAdaptorFactory>(PLUGIN_NAME); | 594 | registry.registerFactory<Sink::ApplicationDomain::Folder, MaildirFolderAdaptorFactory>(PLUGIN_NAME); |
595 | } | 595 | } |
596 | 596 | ||
597 | void MaildirResourceFactory::removeDataFromDisk(const QByteArray &instanceIdentifier) | ||
598 | { | ||
599 | MaildirResource::removeFromDisk(instanceIdentifier); | ||
600 | } | ||
601 | |||
diff --git a/examples/maildirresource/maildirresource.h b/examples/maildirresource/maildirresource.h index 76aef77..490e1e6 100644 --- a/examples/maildirresource/maildirresource.h +++ b/examples/maildirresource/maildirresource.h | |||
@@ -67,5 +67,6 @@ public: | |||
67 | Sink::Resource *createResource(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; | 67 | Sink::Resource *createResource(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; |
68 | void registerFacades(Sink::FacadeFactory &factory) Q_DECL_OVERRIDE; | 68 | void registerFacades(Sink::FacadeFactory &factory) Q_DECL_OVERRIDE; |
69 | void registerAdaptorFactories(Sink::AdaptorFactoryRegistry ®istry) Q_DECL_OVERRIDE; | 69 | void registerAdaptorFactories(Sink::AdaptorFactoryRegistry ®istry) Q_DECL_OVERRIDE; |
70 | void removeDataFromDisk(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; | ||
70 | }; | 71 | }; |
71 | 72 | ||
diff --git a/examples/mailtransportresource/mailtransportresource.cpp b/examples/mailtransportresource/mailtransportresource.cpp index be4e4e0..3ce9476 100644 --- a/examples/mailtransportresource/mailtransportresource.cpp +++ b/examples/mailtransportresource/mailtransportresource.cpp | |||
@@ -205,3 +205,8 @@ void MailtransportResourceFactory::registerAdaptorFactories(Sink::AdaptorFactory | |||
205 | { | 205 | { |
206 | registry.registerFactory<Sink::ApplicationDomain::Mail, DomainTypeAdaptorFactory<ApplicationDomain::Mail>>(PLUGIN_NAME); | 206 | registry.registerFactory<Sink::ApplicationDomain::Mail, DomainTypeAdaptorFactory<ApplicationDomain::Mail>>(PLUGIN_NAME); |
207 | } | 207 | } |
208 | |||
209 | void MailtransportResourceFactory::removeDataFromDisk(const QByteArray &instanceIdentifier) | ||
210 | { | ||
211 | MailtransportResource::removeFromDisk(instanceIdentifier); | ||
212 | } | ||
diff --git a/examples/mailtransportresource/mailtransportresource.h b/examples/mailtransportresource/mailtransportresource.h index cf6abf2..dcc33df 100644 --- a/examples/mailtransportresource/mailtransportresource.h +++ b/examples/mailtransportresource/mailtransportresource.h | |||
@@ -55,5 +55,6 @@ public: | |||
55 | Sink::Resource *createResource(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; | 55 | Sink::Resource *createResource(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; |
56 | void registerFacades(Sink::FacadeFactory &factory) Q_DECL_OVERRIDE; | 56 | void registerFacades(Sink::FacadeFactory &factory) Q_DECL_OVERRIDE; |
57 | void registerAdaptorFactories(Sink::AdaptorFactoryRegistry ®istry) Q_DECL_OVERRIDE; | 57 | void registerAdaptorFactories(Sink::AdaptorFactoryRegistry ®istry) Q_DECL_OVERRIDE; |
58 | void removeDataFromDisk(const QByteArray &instanceIdentifier) Q_DECL_OVERRIDE; | ||
58 | }; | 59 | }; |
59 | 60 | ||