diff options
Diffstat (limited to 'common/clientapi.cpp')
-rw-r--r-- | common/clientapi.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/common/clientapi.cpp b/common/clientapi.cpp index 5eb4b55..73bc194 100644 --- a/common/clientapi.cpp +++ b/common/clientapi.cpp | |||
@@ -197,12 +197,22 @@ KAsync::Job<void> Store::start(const QByteArray &identifier) | |||
197 | 197 | ||
198 | void Store::removeFromDisk(const QByteArray &identifier) | 198 | void Store::removeFromDisk(const QByteArray &identifier) |
199 | { | 199 | { |
200 | //TODO By calling the resource executable with a --remove option instead | 200 | removeDataFromDisk(identifier).exec().waitForFinished(); |
201 | //we can ensure that no other resource process is running at the same time | 201 | } |
202 | QDir dir(Sink::storageLocation()); | 202 | |
203 | for (const auto &folder : dir.entryList(QStringList() << identifier + "*")) { | 203 | KAsync::Job<void> Store::removeDataFromDisk(const QByteArray &identifier) |
204 | Sink::Storage(Sink::storageLocation(), folder, Sink::Storage::ReadWrite).removeFromDisk(); | 204 | { |
205 | } | 205 | //All databases are going to become invalid, nuke the environments |
206 | //TODO: all clients should react to a notification the resource | ||
207 | Sink::Storage::clearEnv(); | ||
208 | Trace() << "Remove data from disk " << identifier; | ||
209 | auto time = QSharedPointer<QTime>::create(); | ||
210 | time->start(); | ||
211 | auto resourceAccess = QSharedPointer<Sink::ResourceAccess>::create(identifier); | ||
212 | resourceAccess->open(); | ||
213 | return resourceAccess->sendCommand(Sink::Commands::RemoveFromDiskCommand).then<void>([resourceAccess, time]() { | ||
214 | Trace() << "Remove from disk complete." << Log::TraceTime(time->elapsed()); | ||
215 | }); | ||
206 | } | 216 | } |
207 | 217 | ||
208 | KAsync::Job<void> Store::synchronize(const Sink::Query &query) | 218 | KAsync::Job<void> Store::synchronize(const Sink::Query &query) |