| 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 #pragma once
5
6 #include <cstdint>
7
8 #include "flutter/fml/macros.h"
9
10 namespace impeller {
11
12 class ArchiveStatement;
13
14 //------------------------------------------------------------------------------
15 /// @brief All writes made to the archive within a transaction that is not
16 /// marked as ready for commit will be rolled back with the
17 /// transaction ends.
18 ///
19 /// All transactions are obtained from the `ArchiveDatabase`.
20 ///
21 /// @see `ArchiveDatabase`
22 ///
23 class ArchiveTransaction {
24 public:
25 ArchiveTransaction(ArchiveTransaction&& transaction);
26
27 ~ArchiveTransaction();
28
29 void MarkWritesAsReadyForCommit();
30
31 private:
32 ArchiveStatement& end_stmt_;
33 ArchiveStatement& rollback_stmt_;
34 int64_t& transaction_count_;
35 bool cleanup_ = false;
36 bool successful_ = false;
37 bool abandoned_ = false;
38
39 friend class ArchiveDatabase;
40
41 ArchiveTransaction(int64_t& transactionCount,
42 ArchiveStatement& beginStatement,
43 ArchiveStatement& endStatement,
44 ArchiveStatement& rollbackStatement);
45
46 FML_DISALLOW_COPY_AND_ASSIGN(ArchiveTransaction);
47 };
48
49 } // namespace impeller
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:23
impeller
Definition: aiks_context.cc:10