File indexing completed on 2025-01-05 03:53:58

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2007-04-15
0007  * Description : Core database abstract backend.
0008  *
0009  * SPDX-FileCopyrightText: 2007-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  * SPDX-FileCopyrightText: 2010-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  *
0012  * SPDX-License-Identifier: GPL-2.0-or-later
0013  *
0014  * ============================================================ */
0015 
0016 #ifndef DIGIKAM_CORE_DB_BACKEND_H
0017 #define DIGIKAM_CORE_DB_BACKEND_H
0018 
0019 // Local includes
0020 
0021 #include "digikam_export.h"
0022 #include "dbenginebackend.h"
0023 #include "coredbchangesets.h"
0024 
0025 namespace Digikam
0026 {
0027 
0028 class CoreDbSchemaUpdater;
0029 class CoreDbWatch;
0030 class CoreDbBackendPrivate;
0031 
0032 class DIGIKAM_DATABASE_EXPORT CoreDbBackend : public BdEngineBackend
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037 
0038     explicit CoreDbBackend(DbEngineLocking* const locking,
0039                            const QString& backendName = QLatin1String("digikamDatabase-"));
0040     ~CoreDbBackend() override;
0041 
0042     /**
0043      * Sets the global database watch
0044      */
0045     void setCoreDbWatch(CoreDbWatch* watch);
0046 
0047     /**
0048      * Initialize the database schema to the current version,
0049      * carry out upgrades if necessary.
0050      * Shall only be called from the thread that called open().
0051      */
0052     bool initSchema(CoreDbSchemaUpdater* updater);
0053 
0054     /**
0055      * Notify all listeners of the changeset
0056      */
0057     void recordChangeset(const ImageChangeset& changeset);
0058     void recordChangeset(const ImageTagChangeset& changeset);
0059     void recordChangeset(const CollectionImageChangeset& changeset);
0060     void recordChangeset(const AlbumChangeset& changeset);
0061     void recordChangeset(const TagChangeset& changeset);
0062     void recordChangeset(const AlbumRootChangeset& changeset);
0063     void recordChangeset(const SearchChangeset& changeset);
0064 
0065 private:
0066 
0067     // Disable
0068     explicit CoreDbBackend(QObject*) = delete;
0069 
0070     Q_DECLARE_PRIVATE(CoreDbBackend)
0071 };
0072 
0073 } // namespace Digikam
0074 
0075 #endif // DIGIKAM_CORE_DB_BACKEND_H