File indexing completed on 2025-01-05 04:59:39

0001 /*
0002  * SPDX-FileCopyrightText: 2015 Mario Bensi <mbensi@ipsquad.net>
0003    SPDX-FileCopyrightText: 2017 Kevin Ottens <ervin@kde.org>
0004    * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005    */
0006 
0007 
0008 #ifndef AKONADI_CACHING_STORAGE_H
0009 #define AKONADI_CACHING_STORAGE_H
0010 
0011 #include "akonadistorageinterface.h"
0012 #include "akonadicache.h"
0013 
0014 namespace Akonadi {
0015 
0016 class CachingStorage : public StorageInterface
0017 {
0018 public:
0019     explicit CachingStorage(const Cache::Ptr &cache, const StorageInterface::Ptr &storage);
0020     virtual ~CachingStorage();
0021 
0022     Akonadi::Collection defaultCollection() override;
0023 
0024     KJob *createItem(Item item, Collection collection) override;
0025     KJob *updateItem(Item item, QObject *parent) override;
0026     KJob *removeItem(Akonadi::Item item, QObject *parent) override;
0027     KJob *removeItems(Item::List items, QObject *parent) override;
0028     KJob *moveItem(Item item, Collection collection, QObject *parent) override;
0029     KJob *moveItems(Item::List item, Collection collection, QObject *parent = nullptr) override;
0030 
0031     KJob *createCollection(Collection collection, QObject *parent) override;
0032     KJob *updateCollection(Collection collection, QObject *parent) override;
0033     KJob *removeCollection(Collection collection, QObject *parent) override;
0034 
0035     KJob *createTransaction(QObject *parent) override;
0036 
0037     CollectionFetchJobInterface *fetchCollections(Akonadi::Collection collection, FetchDepth depth, QObject *parent) override;
0038     ItemFetchJobInterface *fetchItems(Akonadi::Collection collection, QObject *parent) override;
0039     ItemFetchJobInterface *fetchItem(Akonadi::Item item, QObject *parent) override;
0040 
0041 private:
0042     Cache::Ptr m_cache;
0043     StorageInterface::Ptr m_storage;
0044 };
0045 
0046 }
0047 
0048 #endif // AKONADI_CACHING_STORAGE_H