diff options
| author | Kim van der Riet <kpvdr@apache.org> | 2012-07-24 18:27:54 +0000 |
|---|---|---|
| committer | Kim van der Riet <kpvdr@apache.org> | 2012-07-24 18:27:54 +0000 |
| commit | 75e9139d60bc049fabf9b3b779ddd157bb5160bb (patch) | |
| tree | f2f3d1e43cc42428518270a39a8264f41c478648 /cpp/src/qpid/broker | |
| parent | dd79efca55e3ff0a0e0c25e395967ce9b3f80482 (diff) | |
| download | qpid-python-75e9139d60bc049fabf9b3b779ddd157bb5160bb.tar.gz | |
QPID-3858: WIP: Renamed AsyncTransaction to AsyncTransactionalStore; changed some of the broker contexts to more specific classes.
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1365207 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker')
| -rw-r--r-- | cpp/src/qpid/broker/AsyncStore.h | 30 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/TxnAsyncContext.h | 23 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/TxnBuffer.cpp | 2 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/TxnBuffer.h | 6 |
4 files changed, 40 insertions, 21 deletions
diff --git a/cpp/src/qpid/broker/AsyncStore.h b/cpp/src/qpid/broker/AsyncStore.h index 1c8f4b0737..5fb2e0a1eb 100644 --- a/cpp/src/qpid/broker/AsyncStore.h +++ b/cpp/src/qpid/broker/AsyncStore.h @@ -68,11 +68,14 @@ class MessageHandle; class QueueHandle; class TxnHandle; +class QueueAsyncContext; +class TpcTxnAsyncContext; +class TxnAsyncContext; class TxnBuffer; -class AsyncTransaction { +class AsyncTransactionalStore { public: - virtual ~AsyncTransaction() {} + virtual ~AsyncTransactionalStore() {} virtual TxnHandle createTxnHandle() = 0; virtual TxnHandle createTxnHandle(TxnBuffer* tb) = 0; @@ -82,16 +85,16 @@ public: // TODO: Remove boost::shared_ptr<BrokerAsyncContext> from this interface virtual void submitPrepare(TxnHandle&, - boost::shared_ptr<BrokerAsyncContext>) = 0; // Distributed txns only + boost::shared_ptr<TpcTxnAsyncContext>) = 0; // Distributed txns only virtual void submitCommit(TxnHandle&, - boost::shared_ptr<BrokerAsyncContext>) = 0; + boost::shared_ptr<TxnAsyncContext>) = 0; virtual void submitAbort(TxnHandle&, - boost::shared_ptr<BrokerAsyncContext>) = 0; + boost::shared_ptr<TxnAsyncContext>) = 0; void testOp() const {} }; // Subclassed by store: -class AsyncStore : public AsyncTransaction { +class AsyncStore { public: virtual ~AsyncStore() {} @@ -110,6 +113,9 @@ public: // --- Store async interface --- // TODO: Remove boost::shared_ptr<BrokerAsyncContext> from this interface + + // TODO: Switch from BrokerAsyncContext (parent class) to ConfigAsyncContext + // when theses features (and async context classes) are developed. virtual void submitCreate(ConfigHandle&, const DataSource* const, boost::shared_ptr<BrokerAsyncContext>) = 0; @@ -118,12 +124,14 @@ public: virtual void submitCreate(QueueHandle&, const DataSource* const, - boost::shared_ptr<BrokerAsyncContext>) = 0; + boost::shared_ptr<QueueAsyncContext>) = 0; virtual void submitDestroy(QueueHandle&, - boost::shared_ptr<BrokerAsyncContext>) = 0; + boost::shared_ptr<QueueAsyncContext>) = 0; virtual void submitFlush(QueueHandle&, - boost::shared_ptr<BrokerAsyncContext>) = 0; + boost::shared_ptr<QueueAsyncContext>) = 0; + // TODO: Switch from BrokerAsyncContext (parent class) to EventAsyncContext + // when theses features (and async context classes) are developed. virtual void submitCreate(EventHandle&, const DataSource* const, TxnHandle&, @@ -134,10 +142,10 @@ public: virtual void submitEnqueue(EnqueueHandle&, TxnHandle&, - boost::shared_ptr<BrokerAsyncContext>) = 0; + boost::shared_ptr<QueueAsyncContext>) = 0; virtual void submitDequeue(EnqueueHandle&, TxnHandle&, - boost::shared_ptr<BrokerAsyncContext>) = 0; + boost::shared_ptr<QueueAsyncContext>) = 0; // Legacy - Restore FTD message, is NOT async! virtual int loadContent(MessageHandle&, diff --git a/cpp/src/qpid/broker/TxnAsyncContext.h b/cpp/src/qpid/broker/TxnAsyncContext.h index 0c35b110a8..9c617238e8 100644 --- a/cpp/src/qpid/broker/TxnAsyncContext.h +++ b/cpp/src/qpid/broker/TxnAsyncContext.h @@ -29,17 +29,18 @@ #include "qpid/asyncStore/AsyncOperation.h" namespace qpid { -namespace asyncStore { -class AsyncOperation; -} +//namespace asyncStore { +//class AsyncOperation; +//} namespace broker { -class TxnHandle; +class AsyncResultHandle; +class AsyncResultQueue; +//class TxnHandle; typedef void (*AsyncResultCallback)(const AsyncResultHandle* const); -class TxnAsyncContext: public BrokerAsyncContext -{ +class TxnAsyncContext: public BrokerAsyncContext { public: TxnAsyncContext(TxnBuffer* const tb, AsyncResultCallback rcb, @@ -57,6 +58,16 @@ private: AsyncResultQueue* const m_arq; }; +class TpcTxnAsyncContext : public TxnAsyncContext { +public: + TpcTxnAsyncContext(TxnBuffer* const tb, + AsyncResultCallback rcb, + AsyncResultQueue* const arq) : + TxnAsyncContext(tb, rcb, arq) + {} + virtual ~TpcTxnAsyncContext() {} +}; + }} // namespace qpid::broker #endif // qpid_broker_TxnAsyncContext_h_ diff --git a/cpp/src/qpid/broker/TxnBuffer.cpp b/cpp/src/qpid/broker/TxnBuffer.cpp index ba00293452..f85301e036 100644 --- a/cpp/src/qpid/broker/TxnBuffer.cpp +++ b/cpp/src/qpid/broker/TxnBuffer.cpp @@ -81,7 +81,7 @@ TxnBuffer::rollback() } bool -TxnBuffer::commitLocal(AsyncTransaction* const store) +TxnBuffer::commitLocal(AsyncTransactionalStore* const store) { if (store) { try { diff --git a/cpp/src/qpid/broker/TxnBuffer.h b/cpp/src/qpid/broker/TxnBuffer.h index bd9743cad7..7b85a1b6c4 100644 --- a/cpp/src/qpid/broker/TxnBuffer.h +++ b/cpp/src/qpid/broker/TxnBuffer.h @@ -36,7 +36,7 @@ namespace broker { class AsyncResultHandle; class AsyncResultQueue; -class AsyncTransaction; +class AsyncTransactionalStore; class TxnOp; class TxnBuffer { @@ -48,7 +48,7 @@ public: bool prepare(TxnHandle& th); void commit(); void rollback(); - bool commitLocal(AsyncTransaction* const store); + bool commitLocal(AsyncTransactionalStore* const store); // --- Async operations --- void asyncLocalCommit(); @@ -60,7 +60,7 @@ private: std::vector<boost::shared_ptr<TxnOp> > m_ops; qpid::sys::Mutex m_opsMutex; TxnHandle m_txnHandle; - AsyncTransaction* m_store; + AsyncTransactionalStore* m_store; AsyncResultQueue& m_resultQueue; typedef enum {NONE = 0, PREPARE, COMMIT, ROLLBACK, COMPLETE} e_txnState; |
