Akonadi

transactionjobs.h
1 /*
2  SPDX-FileCopyrightText: 2006 Volker Krause <[email protected]>
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 
12 namespace Akonadi
13 {
14 class TransactionJobPrivate;
15 class AKONADICORE_EXPORT TransactionJob : public Job
16 {
17  Q_OBJECT
18 
19 public:
20  ~TransactionJob() override;
21 
22 protected:
23  explicit TransactionJob(QObject *parent);
24 
25  void doStart() override;
26  bool doHandleResponse(qint64 tag, const Protocol::CommandPtr &response) override;
27 
28 private:
29  Q_DECLARE_PRIVATE(TransactionJob)
30 };
31 
32 class 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 <[email protected]>
46  */
47 class AKONADICORE_EXPORT TransactionBeginJob : public TransactionJob
48 {
49  Q_OBJECT
50 
51 public:
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 <[email protected]>
75  */
76 class AKONADICORE_EXPORT TransactionRollbackJob : public TransactionJob
77 {
78  Q_OBJECT
79 
80 public:
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 <[email protected]>
101  */
102 class AKONADICORE_EXPORT TransactionCommitJob : public TransactionJob
103 {
104  Q_OBJECT
105 
106 public:
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 }
122 
Job that begins a session-global transaction.
Job that aborts a session-global transaction.
Job that commits a session-global transaction.
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Oct 6 2022 04:03:46 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.