1 | /* |
2 | SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org> |
3 | |
4 | SPDX-License-Identifier: LGPL-2.1-or-later |
5 | */ |
6 | |
7 | #ifndef BALOO_DOCUMENTDATADB_H |
8 | #define BALOO_DOCUMENTDATADB_H |
9 | |
10 | #include "engine_export.h" |
11 | #include <lmdb.h> |
12 | #include <QByteArray> |
13 | #include <QMap> |
14 | |
15 | namespace Baloo { |
16 | |
17 | class BALOO_ENGINE_EXPORT DocumentDataDB |
18 | { |
19 | public: |
20 | explicit DocumentDataDB(MDB_dbi dbi, MDB_txn* txn); |
21 | ~DocumentDataDB(); |
22 | |
23 | static MDB_dbi create(MDB_txn* txn); |
24 | static MDB_dbi open(MDB_txn* txn); |
25 | |
26 | void put(quint64 docId, const QByteArray& data); |
27 | QByteArray get(quint64 docId); |
28 | |
29 | void del(quint64 docId); |
30 | bool contains(quint64 docId); |
31 | |
32 | QMap<quint64, QByteArray> toTestMap() const; |
33 | private: |
34 | MDB_txn* m_txn; |
35 | MDB_dbi m_dbi; |
36 | }; |
37 | |
38 | } |
39 | |
40 | #endif // BALOO_DOCUMENTDATADB_H |
41 | |