File indexing completed on 2024-04-21 03:51:40
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_IDTREEDB_H 0009 #define BALOO_IDTREEDB_H 0010 0011 #include "engine_export.h" 0012 #include <lmdb.h> 0013 #include <QVector> 0014 #include <QMap> 0015 0016 namespace Baloo { 0017 0018 class PostingIterator; 0019 0020 class BALOO_ENGINE_EXPORT IdTreeDB 0021 { 0022 public: 0023 IdTreeDB(MDB_dbi dbi, MDB_txn* txn); 0024 0025 static MDB_dbi create(MDB_txn* txn); 0026 static MDB_dbi open(MDB_txn* txn); 0027 0028 void set(quint64 docId, const QVector<quint64> &subDocIds); 0029 QVector<quint64> get(quint64 docId); 0030 0031 /** 0032 * Returns an iterator which will return all the docIds which use \p docId 0033 * are the parent docID. 0034 */ 0035 PostingIterator* iter(quint64 docId); 0036 0037 QMap<quint64, QVector<quint64>> toTestMap() const; 0038 private: 0039 MDB_txn* m_txn; 0040 MDB_dbi m_dbi; 0041 }; 0042 } 0043 0044 #endif // BALOO_IDTREEDB_H