Akonadi

transactionjobs.h
1/*
2 SPDX-FileCopyrightText: 2006 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadicore_export.h"
10#include "job.h"
11
12namespace Akonadi
13{
14class TransactionJobPrivate;
15class AKONADICORE_EXPORT TransactionJob : public Job
16{
17 Q_OBJECT
18
19public:
20 ~TransactionJob() override;
21
22protected:
23 explicit TransactionJob(QObject *parent);
24
25 void doStart() override;
26 bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
27
28private:
29 Q_DECLARE_PRIVATE(TransactionJob)
30};
31
32class TransactionJobPrivate;
33
34/**
35 * @short Job that begins a session-global transaction.
36 *
37 * Sometimes you want to execute a sequence of commands in
38 * an atomic way, so that either all commands or none shall
39 * be executed. The TransactionBeginJob, TransactionCommitJob and
40 * TransactionRollbackJob provide these functionality for the
41 * Akonadi Job classes.
42 *
43 * @note This will only have an effect when used as a subjob or with a Session.
44 *
45 * @author Volker Krause <vkrause@kde.org>
46 */
47class AKONADICORE_EXPORT TransactionBeginJob : public TransactionJob
48{
49 Q_OBJECT
50
51public:
52 /**
53 * Creates a new transaction begin job.
54 *
55 * @param parent The parent job or Session, must not be 0.
56 */
57 explicit TransactionBeginJob(QObject *parent);
58
59 /**
60 * Destroys the transaction begin job.
61 */
62 ~TransactionBeginJob() override;
63};
64
65/**
66 * @short Job that aborts a session-global transaction.
67 *
68 * If a job inside a TransactionBeginJob has been failed,
69 * the TransactionRollbackJob can be used to rollback all changes done by these
70 * jobs.
71 *
72 * @note This will only have an effect when used as a subjob or with a Session.
73 *
74 * @author Volker Krause <vkrause@kde.org>
75 */
76class AKONADICORE_EXPORT TransactionRollbackJob : public TransactionJob
77{
78 Q_OBJECT
79
80public:
81 /**
82 * Creates a new transaction rollback job.
83 * The parent must be the same parent as for the TransactionBeginJob.
84 *
85 * @param parent The parent job or Session, must not be 0.
86 */
87 explicit TransactionRollbackJob(QObject *parent);
88
89 /**
90 * Destroys the transaction rollback job.
91 */
92 ~TransactionRollbackJob() override;
93};
94
95/**
96 * @short Job that commits a session-global transaction.
97 *
98 * This job commits all changes of this transaction.
99 *
100 * @author Volker Krause <vkrause@kde.org>
101 */
102class AKONADICORE_EXPORT TransactionCommitJob : public TransactionJob
103{
104 Q_OBJECT
105
106public:
107 /**
108 * Creates a new transaction commit job.
109 * The parent must be the same parent as for the TransactionBeginJob.
110 *
111 * @param parent The parent job or Session, must not be 0.
112 */
113 explicit TransactionCommitJob(QObject *parent);
114
115 /**
116 * Destroys the transaction commit job.
117 */
118 ~TransactionCommitJob() override;
119};
120
121}
Job that begins a session-global transaction.
Job that commits a session-global transaction.
Job that aborts a session-global transaction.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 7 2024 11:56:44 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.