| Flutter Impeller |

Public Member Functions | Friends | List of all members
impeller::ArchiveTransaction Class Reference

All writes made to the archive within a transaction that is not marked as ready for commit will be rolled back with the transaction ends. More...

`#include <archive_transaction.h>`

## Public Member Functions
| ArchiveTransaction (ArchiveTransaction &&transaction)
| ~ArchiveTransaction ()
void | MarkWritesAsReadyForCommit ()

## Friends
class | ArchiveDatabase

## Detailed Description

All writes made to the archive within a transaction that is not marked as ready for commit will be rolled back with the transaction ends.

All transactions are obtained from the `ArchiveDatabase`.

See also
  `ArchiveDatabase`

Definition at line 22 of file archive_transaction.h.

## Constructor & Destructor Documentation

## ◆ ArchiveTransaction()

impeller::ArchiveTransaction::ArchiveTransaction | ( | ArchiveTransaction && | transaction | ) |

Definition at line 25 of file archive_transaction.cc.

26 : end_stmt_(other.end_stmt_),
27 rollback_stmt_(other.rollback_stmt_),
28 transaction_count_(other.transaction_count_),
29 cleanup_(other.cleanup_),
30 successful_(other.successful_) {
31 other.abandoned_ = true;
32 }

## ◆ ~ArchiveTransaction()

impeller::ArchiveTransaction::~ArchiveTransaction | ( |  | ) |

Definition at line 34 of file archive_transaction.cc.

34 {
35 if (abandoned_) {
36 return;
37 }
38
39 FML_CHECK(transaction_count_ != 0);
40 if (transaction_count_ == 1 && cleanup_) {
41 auto res = successful_ ? end_stmt_.Execute() : rollback_stmt_.Execute();
42 FML_CHECK(res == ArchiveStatement::Result::kDone)
43 << "Must be able to commit the nested transaction";
44 }
45 transaction_count_--;
46 }

References impeller::ArchiveStatement::Execute(), and impeller::ArchiveStatement::kDone.

## Member Function Documentation

## ◆ MarkWritesAsReadyForCommit()

void impeller::ArchiveTransaction::MarkWritesAsReadyForCommit | ( |  | ) |

Definition at line 48 of file archive_transaction.cc.

48 {
49 successful_ = true;
50 }

## Friends And Related Function Documentation

## ◆ ArchiveDatabase

friend class ArchiveDatabase
| friend

Definition at line 38 of file archive_transaction.h.

The documentation for this class was generated from the following files:

- impeller/archivist/archive_transaction.h
- impeller/archivist/archive_transaction.cc

impeller::ArchiveStatement::Result::kDone
@ kDone
impeller::ArchiveStatement::Execute
Result Execute()
Execute the given statement with the provided data.
Definition: archive_statement.cc:217