2 * Copyright 2010, Haiku Inc. All rights reserved.
3 * Copyright 2001-2010, Axel Dörfler, axeld@pinc-software.de.
4 * This file may be used under the terms of the MIT License.
7 * Janito V. Ferreira Filho
13 #include <util/DoublyLinkedList.h>
20 class TransactionListener
21 : public DoublyLinkedListLinkImpl
<TransactionListener
> {
23 TransactionListener();
24 virtual ~TransactionListener();
26 virtual void TransactionDone(bool success
) = 0;
27 virtual void RemovedFromTransaction() = 0;
30 typedef DoublyLinkedList
<TransactionListener
> TransactionListeners
;
36 Transaction(Journal
* journal
);
39 status_t
Start(Journal
* journal
);
40 status_t
Done(bool success
= true);
42 bool IsStarted() const;
43 bool HasParent() const;
45 status_t
WriteBlocks(off_t blockNumber
,
47 size_t numBlocks
= 1);
51 Volume
* GetVolume() const;
54 void AddListener(TransactionListener
* listener
);
56 TransactionListener
* listener
);
58 void NotifyListeners(bool success
);
59 void MoveListenersTo(Transaction
* transaction
);
61 void SetParent(Transaction
* transaction
);
62 Transaction
* Parent() const;
64 Transaction(const Transaction
& other
);
65 Transaction
& operator=(const Transaction
& other
);
69 TransactionListeners fListeners
;
73 #endif // TRANSACTION_H