From 9e1850071a471ce275194f3882054694cea798e7 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 17 Oct 2016 20:28:24 +0200 Subject: Removed the now obsolete EntityStore --- common/CMakeLists.txt | 1 - common/entitystore.cpp | 29 ---------------------- common/entitystore.h | 61 ---------------------------------------------- common/sourcewriteback.cpp | 13 +++------- common/sourcewriteback.h | 5 ++-- common/synchronizer.cpp | 1 - common/synchronizer.h | 1 - 7 files changed, 6 insertions(+), 105 deletions(-) delete mode 100644 common/entitystore.cpp delete mode 100644 common/entitystore.h (limited to 'common') diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index e1e7a51..fd8e898 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -69,7 +69,6 @@ set(command_SRCS changereplay.cpp adaptorfactoryregistry.cpp synchronizer.cpp - entitystore.cpp remoteidmap.cpp sourcewriteback.cpp entityreader.cpp diff --git a/common/entitystore.cpp b/common/entitystore.cpp deleted file mode 100644 index b7b03aa..0000000 --- a/common/entitystore.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2016 Christian Mollekopf - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version accepted by the membership of KDE e.V. (or its - * successor approved by the membership of KDE e.V.), which shall - * act as a proxy defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ -#include "entitystore.h" - -using namespace Sink; - -EntityStore::EntityStore(Storage::EntityStore &store_) - : store(store_) -{ - -} - diff --git a/common/entitystore.h b/common/entitystore.h deleted file mode 100644 index 3d9ca36..0000000 --- a/common/entitystore.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2016 Christian Mollekopf - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version accepted by the membership of KDE e.V. (or its - * successor approved by the membership of KDE e.V.), which shall - * act as a proxy defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ -#pragma once - -#include "sink_export.h" - -#include "storage/entitystore.h" - -namespace Sink { - -class SINK_EXPORT EntityStore -{ -public: - EntityStore(Storage::EntityStore &store); - - template - T read(const QByteArray &identifier) const - { - return store.readLatest(identifier); - } - - template - T readFromKey(const QByteArray &key) const - { - return store.readEntity(key); - } - - template - T readPrevious(const QByteArray &uid, qint64 revision) const - { - return store.readPrevious(uid, revision); - } - - /* template */ - /* EntityReader reader() */ - /* { */ - /* return EntityReader(mResourceType, mResourceInstanceIdentifier, mTransaction); */ - /* } */ - -private: - Sink::Storage::EntityStore &store; -}; - -} diff --git a/common/sourcewriteback.cpp b/common/sourcewriteback.cpp index 204793e..e2994d1 100644 --- a/common/sourcewriteback.cpp +++ b/common/sourcewriteback.cpp @@ -41,12 +41,9 @@ SourceWriteBack::SourceWriteBack(const ResourceContext &context) } -EntityStore &SourceWriteBack::store() +Storage::EntityStore &SourceWriteBack::store() { - if (!mEntityStoreWrapper) { - mEntityStoreWrapper = QSharedPointer::create(*mEntityStore); - } - return *mEntityStoreWrapper; + return *mEntityStore; } RemoteIdMap &SourceWriteBack::syncStore() @@ -78,7 +75,6 @@ KAsync::Job SourceWriteBack::replay(const QByteArray &type, const QByteArr const auto metadataBuffer = Sink::EntityBuffer::readBuffer(entity.metadata()); Q_ASSERT(metadataBuffer); Q_ASSERT(!mSyncStore); - Q_ASSERT(!mEntityStoreWrapper); Q_ASSERT(!mSyncTransaction); mEntityStore->startTransaction(Storage::DataStore::ReadOnly); mSyncTransaction = mSyncStorage.createTransaction(Sink::Storage::DataStore::ReadWrite); @@ -100,10 +96,10 @@ KAsync::Job SourceWriteBack::replay(const QByteArray &type, const QByteArr KAsync::Job job = KAsync::null(); if (type == ENTITY_TYPE_FOLDER) { - auto folder = store().readFromKey(key); + auto folder = store().readEntity(key); job = replay(folder, operation, oldRemoteId, modifiedProperties); } else if (type == ENTITY_TYPE_MAIL) { - auto mail = store().readFromKey(key); + auto mail = store().readEntity(key); job = replay(mail, operation, oldRemoteId, modifiedProperties); } @@ -134,7 +130,6 @@ KAsync::Job SourceWriteBack::replay(const QByteArray &type, const QByteArr SinkWarning() << "Failed to replay change: " << error.errorMessage; } mSyncStore.clear(); - mEntityStoreWrapper.clear(); mSyncTransaction.commit(); mEntityStore->abortTransaction(); }); diff --git a/common/sourcewriteback.h b/common/sourcewriteback.h index 327d1ad..cf393e4 100644 --- a/common/sourcewriteback.h +++ b/common/sourcewriteback.h @@ -23,7 +23,7 @@ #include "changereplay.h" #include "storage.h" -#include "entitystore.h" +#include "storage/entitystore.h" #include "remoteidmap.h" #include "metadata_generated.h" @@ -58,12 +58,11 @@ protected: private: //Read only access to main storage - EntityStore &store(); + Storage::EntityStore &store(); ResourceContext mResourceContext; Sink::Storage::DataStore mSyncStorage; QSharedPointer mSyncStore; QSharedPointer mEntityStore; - QSharedPointer mEntityStoreWrapper; Sink::Storage::DataStore::Transaction mSyncTransaction; QByteArray mResourceType; QByteArray mResourceInstanceIdentifier; diff --git a/common/synchronizer.cpp b/common/synchronizer.cpp index 5ddd77c..9bba9cf 100644 --- a/common/synchronizer.cpp +++ b/common/synchronizer.cpp @@ -22,7 +22,6 @@ #include "definitions.h" #include "commands.h" #include "bufferutils.h" -#include "entitystore.h" #include "remoteidmap.h" #include "entityreader.h" #include "createentity_generated.h" diff --git a/common/synchronizer.h b/common/synchronizer.h index f3319f6..0a1efe1 100644 --- a/common/synchronizer.h +++ b/common/synchronizer.h @@ -28,7 +28,6 @@ #include namespace Sink { -class EntityStore; class RemoteIdMap; /** -- cgit v1.2.3