StartedTransaction.h (1105B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef DOM_FS_PARENT_STARTEDTRANSACTION_H_ 8 #define DOM_FS_PARENT_STARTEDTRANSACTION_H_ 9 10 #include "ResultConnection.h" 11 #include "mozStorageHelper.h" 12 #include "mozilla/dom/QMResult.h" 13 14 namespace mozilla::dom::fs { 15 16 class StartedTransaction { 17 public: 18 static Result<StartedTransaction, QMResult> Create( 19 const ResultConnection& aConn); 20 21 StartedTransaction(StartedTransaction&& aOther) = default; 22 23 StartedTransaction(const StartedTransaction& aOther) = delete; 24 25 nsresult Commit(); 26 27 nsresult Rollback(); 28 29 ~StartedTransaction() = default; 30 31 private: 32 explicit StartedTransaction(UniquePtr<mozStorageTransaction>&& aTransaction); 33 34 UniquePtr<mozStorageTransaction> mTransaction; 35 }; 36 37 } // namespace mozilla::dom::fs 38 39 #endif // DOM_FS_PARENT_STARTEDTRANSACTION_H_