8#ifndef BALOO_TRANSACTION_H
9#define BALOO_TRANSACTION_H
11#include "databasedbis.h"
14#include "writetransaction.h"
15#include "documenttimedb.h"
30class BALOO_ENGINE_EXPORT Transaction
33 enum TransactionType {
37 Transaction(
const Database& db, TransactionType type);
38 Transaction(Database* db, TransactionType type);
44 bool hasDocument(quint64
id)
const;
45 bool inPhaseOne(quint64
id)
const;
46 bool hasFailed(quint64
id)
const;
54 quint64 documentId(
const QByteArray& path)
const;
57 DocumentTimeDB::TimeInfo documentTimeInfo(quint64
id)
const;
59 PostingIterator* postingIterator(
const EngineQuery& query)
const;
60 PostingIterator* postingCompIterator(
const QByteArray& prefix, qlonglong value, PostingDB::Comparator com)
const;
61 PostingIterator* postingCompIterator(
const QByteArray& prefix,
double value, PostingDB::Comparator com)
const;
62 PostingIterator* postingCompIterator(
const QByteArray& prefix,
const QByteArray& value, PostingDB::Comparator com)
const;
63 PostingIterator* mTimeRangeIter(quint32 beginTime, quint32 endTime)
const;
64 PostingIterator* docUrlIter(quint64
id)
const;
67 uint phaseOneSize()
const;
79 DatabaseSize dbSize();
86 void reset(TransactionType type);
91 void addDocument(
const Document& doc);
92 void removeDocument(quint64
id);
93 void removeRecursively(quint64 parentId);
94 void addFailed(quint64
id);
96 bool removeRecursively(quint64 parentId, std::function<
bool(quint64)> shouldDelete)
99 Q_ASSERT(m_writeTrans);
101 return m_writeTrans->removeRecursively(parentId, shouldDelete);
104 void replaceDocument(
const Document& doc, DocumentOperations operations);
105 void setPhaseOne(quint64
id);
106 void removePhaseOne(quint64
id);
110 void checkTermsDbinPostingDb();
111 void checkPostingDbinTermsDb();
114 Transaction(
const Transaction& rhs) =
delete;
115 void init(TransactionType type);
117 const DatabaseDbis& m_dbis;
118 MDB_txn *m_txn =
nullptr;
119 MDB_env *m_env =
nullptr;
120 std::unique_ptr<WriteTransaction> m_writeTrans;
122 friend class DatabaseSanitizerImpl;
123 friend class DBState;
Q_SCRIPTABLE Q_NOREPLY void abort()
Implements storage for docIds without any associated data Instantiated for: