File indexing completed on 2024-04-14 03:49:41
0001 /* 0002 This file is part of the KDE Baloo project. 0003 SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #ifndef BALOO_DOCUMENTIDDB_H 0009 #define BALOO_DOCUMENTIDDB_H 0010 0011 #include "engine_export.h" 0012 #include <QVector> 0013 #include <lmdb.h> 0014 0015 /** 0016 * Implements storage for docIds without any associated data 0017 * Instantiated for: 0018 * - content indexing (files to be reindexed) 0019 * - failed ids (files no indexable, e.g. due to crashing indexers) 0020 */ 0021 namespace Baloo { 0022 0023 class BALOO_ENGINE_EXPORT DocumentIdDB 0024 { 0025 public: 0026 DocumentIdDB(MDB_dbi dbi, MDB_txn* txn); 0027 ~DocumentIdDB(); 0028 0029 static MDB_dbi create(const char* name, MDB_txn* txn); 0030 static MDB_dbi open(const char* name, MDB_txn* txn); 0031 0032 void put(quint64 docId); 0033 bool contains(quint64 docId); 0034 void del(quint64 docID); 0035 0036 QVector<quint64> fetchItems(int size); 0037 uint size(); 0038 0039 QVector<quint64> toTestVector() const; 0040 private: 0041 MDB_txn* m_txn; 0042 MDB_dbi m_dbi; 0043 }; 0044 0045 } 0046 0047 #endif // BALOO_DOCUMENTIDDB_H