| Flutter Impeller |

archive_transaction.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 #ifndef FLUTTER_IMPELLER_ARCHIVIST_ARCHIVE_TRANSACTION_H_
5 #define FLUTTER_IMPELLER_ARCHIVIST_ARCHIVE_TRANSACTION_H_
6
7 #include <cstdint>
8
9 namespace impeller {
10
11 class ArchiveStatement;
12
13 //------------------------------------------------------------------------------
14 /// @brief All writes made to the archive within a transaction that is not
15 /// marked as ready for commit will be rolled back with the
16 /// transaction ends.
17 ///
18 /// All transactions are obtained from the `ArchiveDatabase`.
19 ///
20 /// @see `ArchiveDatabase`
21 ///
22 class ArchiveTransaction {
23 public:
24 ArchiveTransaction(ArchiveTransaction&& transaction);
25
26 ~ArchiveTransaction();
27
28 void MarkWritesAsReadyForCommit();
29
30 private:
31 ArchiveStatement& end_stmt_;
32 ArchiveStatement& rollback_stmt_;
33 int64_t& transaction_count_;
34 bool cleanup_ = false;
35 bool successful_ = false;
36 bool abandoned_ = false;
37
38 friend class ArchiveDatabase;
39
40 ArchiveTransaction(int64_t& transactionCount,
41 ArchiveStatement& beginStatement,
42 ArchiveStatement& endStatement,
43 ArchiveStatement& rollbackStatement);
44
45 ArchiveTransaction(const ArchiveTransaction&) = delete;
46
47 ArchiveTransaction& operator=(const ArchiveTransaction&) = delete;
48 };
49
50 } // namespace impeller
51
52 #endif // FLUTTER_IMPELLER_ARCHIVIST_ARCHIVE_TRANSACTION_H_
impeller::ArchiveDatabase
A handle to the underlying database connection for an archive.
Definition: archive_database.h:23
impeller::ArchiveStatement
Represents a read/write query to an archive database. Statements are expensive to create and must be ...
Definition: archive_statement.h:20
impeller::ArchiveTransaction::MarkWritesAsReadyForCommit
void MarkWritesAsReadyForCommit()
Definition: archive_transaction.cc:48
impeller::ArchiveTransaction::ArchiveTransaction
ArchiveTransaction(ArchiveTransaction &&transaction)
Definition: archive_transaction.cc:25
impeller::ArchiveTransaction::~ArchiveTransaction
~ArchiveTransaction()
Definition: archive_transaction.cc:34
impeller::ArchiveTransaction
All writes made to the archive within a transaction that is not marked as ready for commit will be ro...
Definition: archive_transaction.h:22
impeller
Definition: aiks_context.cc:10