Changeset View
Changeset View
Standalone View
Standalone View
src/engine/transaction.h
Show All 20 Lines | |||||
21 | #ifndef BALOO_TRANSACTION_H | 21 | #ifndef BALOO_TRANSACTION_H | ||
22 | #define BALOO_TRANSACTION_H | 22 | #define BALOO_TRANSACTION_H | ||
23 | 23 | | |||
24 | #include "databasedbis.h" | 24 | #include "databasedbis.h" | ||
25 | #include "mtimedb.h" | 25 | #include "mtimedb.h" | ||
26 | #include "postingdb.h" | 26 | #include "postingdb.h" | ||
27 | #include "writetransaction.h" | 27 | #include "writetransaction.h" | ||
28 | #include "documenttimedb.h" | 28 | #include "documenttimedb.h" | ||
29 | #include <functional> | ||||
29 | 30 | | |||
30 | #include <QString> | 31 | #include <QString> | ||
31 | #include <lmdb.h> | 32 | #include <lmdb.h> | ||
32 | 33 | | |||
33 | namespace Baloo { | 34 | namespace Baloo { | ||
34 | 35 | | |||
35 | class Database; | 36 | class Database; | ||
36 | class Document; | 37 | class Document; | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | 45 | public: | |||
102 | // | 103 | // | ||
103 | // Write Methods | 104 | // Write Methods | ||
104 | // | 105 | // | ||
105 | void addDocument(const Document& doc); | 106 | void addDocument(const Document& doc); | ||
106 | void removeDocument(quint64 id); | 107 | void removeDocument(quint64 id); | ||
107 | void removeRecursively(quint64 parentId); | 108 | void removeRecursively(quint64 parentId); | ||
108 | void addFailed(quint64 id); | 109 | void addFailed(quint64 id); | ||
109 | 110 | | |||
110 | template <typename Functor> | 111 | bool removeRecursively(quint64 parentId, std::function<bool(quint64)> shouldDelete) | ||
111 | void removeRecursively(quint64 id, Functor shouldDelete) { | 112 | { | ||
112 | Q_ASSERT(m_txn); | 113 | Q_ASSERT(m_txn); | ||
113 | Q_ASSERT(m_writeTrans); | 114 | Q_ASSERT(m_writeTrans); | ||
114 | 115 | | |||
115 | m_writeTrans->removeRecursively(id, shouldDelete); | 116 | return m_writeTrans->removeRecursively(parentId, shouldDelete); | ||
116 | } | 117 | } | ||
117 | 118 | | |||
118 | void replaceDocument(const Document& doc, DocumentOperations operations); | 119 | void replaceDocument(const Document& doc, DocumentOperations operations); | ||
119 | void setPhaseOne(quint64 id); | 120 | void setPhaseOne(quint64 id); | ||
120 | void removePhaseOne(quint64 id); | 121 | void removePhaseOne(quint64 id); | ||
121 | 122 | | |||
122 | // Debugging | 123 | // Debugging | ||
123 | void checkFsTree(); | 124 | void checkFsTree(); | ||
Show All 17 Lines |