Baloo

mtimedb.h
1 /*
2  This file is part of the KDE Baloo project.
3  SPDX-FileCopyrightText: 2015 Vishesh Handa <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-or-later
6 */
7 
8 #ifndef BALOO_MTIMEDB_H
9 #define BALOO_MTIMEDB_H
10 
11 #include "engine_export.h"
12 #include <lmdb.h>
13 #include <QVector>
14 #include <QMap>
15 
16 namespace Baloo {
17 
18 class PostingIterator;
19 
20 /**
21  * The MTime DB maps the file mtime to its id. This allows us to do
22  * fast searches of files between a certain time range.
23  */
24 class BALOO_ENGINE_EXPORT MTimeDB
25 {
26 public:
27  explicit MTimeDB(MDB_dbi dbi, MDB_txn* txn);
28  ~MTimeDB();
29 
30  static MDB_dbi create(MDB_txn* txn);
31  static MDB_dbi open(MDB_txn* txn);
32 
33  void put(quint32 mtime, quint64 docId);
34  QVector<quint64> get(quint32 mtime);
35 
36  void del(quint32 mtime, quint64 docId);
37 
38  /**
39  * Get documents with an mtime between \p beginTime and
40  * \p endTime (inclusive)
41  */
42  PostingIterator* iterRange(quint32 beginTime, quint32 endTime);
43 
44  QMap<quint32, quint64> toTestMap() const;
45 private:
46  MDB_txn* m_txn;
47  MDB_dbi m_dbi;
48 };
49 }
50 
51 #endif // BALOO_MTIMEDB_H
A PostingIterator is an abstract base class which can be used to iterate over all the "postings" or "...
The MTime DB maps the file mtime to its id.
Definition: mtimedb.h:24
Implements storage for docIds without any associated data Instantiated for:
Definition: coding.cpp:11
virtual bool put(ScriptableExtension *callerPrincipal, quint64 objId, const QString &propName, const QVariant &value)
virtual QVariant get(ScriptableExtension *callerPrincipal, quint64 objId, const QString &propName)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Sep 26 2023 04:09:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.