From 220841d24ff48f27339000e887d5465a53c39013 Mon Sep 17 00:00:00 2001 From: Kim van der Riet Date: Mon, 14 May 2012 18:05:26 +0000 Subject: QPID-3858: More restructuring: Renamed XXXContext to XXXAsyncContext for all async store context classes, also avoids name clash with TransactionContext, an existing non-async context class. git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1338318 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/CMakeLists.txt | 2 +- cpp/src/qpid/asyncStore/AsyncOperation.cpp | 9 ++- cpp/src/qpid/asyncStore/AsyncOperation.h | 10 +-- cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp | 32 +++++----- cpp/src/qpid/asyncStore/AsyncStoreImpl.h | 32 +++++----- cpp/src/qpid/asyncStore/OperationQueue.cpp | 2 +- cpp/src/qpid/broker/AsyncStore.h | 36 +++++------ cpp/src/qpid/broker/BrokerAsyncContext.h | 15 +++++ cpp/src/qpid/broker/BrokerContext.h | 15 ----- cpp/src/tests/CMakeLists.txt | 4 +- .../asyncPerf/MessageAsyncContext.cpp | 74 ++++++++++++++++++++++ .../storePerftools/asyncPerf/MessageAsyncContext.h | 56 ++++++++++++++++ .../storePerftools/asyncPerf/MessageContext.cpp | 74 ---------------------- .../storePerftools/asyncPerf/MessageContext.h | 53 ---------------- .../asyncPerf/MockPersistableMessage.cpp | 4 +- .../asyncPerf/MockPersistableMessage.h | 8 +-- .../asyncPerf/MockPersistableQueue.cpp | 25 ++++---- .../asyncPerf/MockPersistableQueue.h | 13 ++-- .../asyncPerf/MockTransactionContext.cpp | 37 ++--------- .../asyncPerf/MockTransactionContext.h | 23 +------ .../storePerftools/asyncPerf/QueueAsyncContext.cpp | 66 +++++++++++++++++++ .../storePerftools/asyncPerf/QueueAsyncContext.h | 52 +++++++++++++++ .../storePerftools/asyncPerf/QueueContext.cpp | 66 ------------------- .../tests/storePerftools/asyncPerf/QueueContext.h | 51 --------------- .../asyncPerf/TransactionAsyncContext.cpp | 2 +- .../asyncPerf/TransactionAsyncContext.h | 5 +- 26 files changed, 359 insertions(+), 407 deletions(-) create mode 100644 cpp/src/qpid/broker/BrokerAsyncContext.h delete mode 100644 cpp/src/qpid/broker/BrokerContext.h create mode 100644 cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp create mode 100644 cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h delete mode 100644 cpp/src/tests/storePerftools/asyncPerf/MessageContext.cpp delete mode 100644 cpp/src/tests/storePerftools/asyncPerf/MessageContext.h create mode 100644 cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp create mode 100644 cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h delete mode 100644 cpp/src/tests/storePerftools/asyncPerf/QueueContext.cpp delete mode 100644 cpp/src/tests/storePerftools/asyncPerf/QueueContext.h diff --git a/cpp/src/CMakeLists.txt b/cpp/src/CMakeLists.txt index 36c0e0aa69..8246050f96 100644 --- a/cpp/src/CMakeLists.txt +++ b/cpp/src/CMakeLists.txt @@ -1078,7 +1078,7 @@ set (qpidbroker_SOURCES qpid/amqp_0_10/Connection.cpp qpid/broker/AsyncStore.cpp qpid/broker/Broker.cpp - qpid/broker/BrokerContext.h + qpid/broker/BrokerAsyncContext.h qpid/broker/Credit.cpp qpid/broker/Exchange.cpp qpid/broker/ExpiryPolicy.cpp diff --git a/cpp/src/qpid/asyncStore/AsyncOperation.cpp b/cpp/src/qpid/asyncStore/AsyncOperation.cpp index 87d3713b96..19b15b12d0 100644 --- a/cpp/src/qpid/asyncStore/AsyncOperation.cpp +++ b/cpp/src/qpid/asyncStore/AsyncOperation.cpp @@ -24,7 +24,6 @@ #include "AsyncOperation.h" #include "qpid/Exception.h" -#include "qpid/broker/BrokerContext.h" // for delete in d'tor #include @@ -43,7 +42,7 @@ AsyncOperation::AsyncOperation() : AsyncOperation::AsyncOperation(const opCode op, const qpid::broker::IdHandle* th, const qpid::broker::ResultCallback resCb, - qpid::broker::BrokerContext* brokerCtxt) : + qpid::broker::BrokerAsyncContext* brokerCtxt) : m_op(op), m_targetHandle(th), m_dataSrc(0), @@ -56,7 +55,7 @@ AsyncOperation::AsyncOperation(const opCode op, const qpid::broker::IdHandle* th, const qpid::broker::DataSource* dataSrc, const qpid::broker::ResultCallback resCb, - qpid::broker::BrokerContext* brokerCtxt) : + qpid::broker::BrokerAsyncContext* brokerCtxt) : m_op(op), m_targetHandle(th), m_dataSrc(dataSrc), @@ -69,7 +68,7 @@ AsyncOperation::AsyncOperation(const opCode op, const qpid::broker::IdHandle* th, const qpid::broker::TxnHandle* txnHandle, const qpid::broker::ResultCallback resCb, - qpid::broker::BrokerContext* brokerCtxt) : + qpid::broker::BrokerAsyncContext* brokerCtxt) : m_op(op), m_targetHandle(th), m_dataSrc(0), @@ -83,7 +82,7 @@ AsyncOperation::AsyncOperation(const opCode op, const qpid::broker::DataSource* dataSrc, const qpid::broker::TxnHandle* txnHandle, const qpid::broker::ResultCallback resCb, - qpid::broker::BrokerContext* brokerCtxt) : + qpid::broker::BrokerAsyncContext* brokerCtxt) : m_op(op), m_targetHandle(th), m_dataSrc(dataSrc), diff --git a/cpp/src/qpid/asyncStore/AsyncOperation.h b/cpp/src/qpid/asyncStore/AsyncOperation.h index 756b393b90..998d03955e 100644 --- a/cpp/src/qpid/asyncStore/AsyncOperation.h +++ b/cpp/src/qpid/asyncStore/AsyncOperation.h @@ -51,23 +51,23 @@ public: AsyncOperation(const opCode op, const qpid::broker::IdHandle* th, const qpid::broker::ResultCallback resCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); AsyncOperation(const opCode op, const qpid::broker::IdHandle* th, const qpid::broker::DataSource* dataSrc, const qpid::broker::ResultCallback resCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); AsyncOperation(const opCode op, const qpid::broker::IdHandle* th, const qpid::broker::TxnHandle* txnHandle, const qpid::broker::ResultCallback resCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); AsyncOperation(const opCode op, const qpid::broker::IdHandle* th, const qpid::broker::DataSource* dataSrc, const qpid::broker::TxnHandle* txnHandle, const qpid::broker::ResultCallback resCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); virtual ~AsyncOperation(); const char* getOpStr() const; static const char* getOpStr(const opCode op); @@ -77,7 +77,7 @@ public: const qpid::broker::DataSource* m_dataSrc; const qpid::broker::TxnHandle* m_txnHandle; const qpid::broker::ResultCallback m_resCb; - qpid::broker::BrokerContext* m_brokerCtxt; + qpid::broker::BrokerAsyncContext* m_brokerCtxt; }; }} // namespace qpid::asyncStore diff --git a/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp b/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp index 3bdb2c3b98..5a4905fef6 100644 --- a/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp +++ b/cpp/src/qpid/asyncStore/AsyncStoreImpl.cpp @@ -105,7 +105,7 @@ AsyncStoreImpl::createEnqueueHandle(qpid::broker::MessageHandle& msgHandle, void AsyncStoreImpl::submitPrepare(qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::TXN_PREPARE, dynamic_cast(&txnHandle), @@ -117,7 +117,7 @@ AsyncStoreImpl::submitPrepare(qpid::broker::TxnHandle& txnHandle, void AsyncStoreImpl::submitCommit(qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::TXN_COMMIT, dynamic_cast(&txnHandle), @@ -129,7 +129,7 @@ AsyncStoreImpl::submitCommit(qpid::broker::TxnHandle& txnHandle, void AsyncStoreImpl::submitAbort(qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::TXN_ABORT, dynamic_cast(&txnHandle), @@ -142,7 +142,7 @@ void AsyncStoreImpl::submitCreate(qpid::broker::ConfigHandle& cfgHandle, const qpid::broker::DataSource* dataSrc, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::CONFIG_CREATE, dynamic_cast(&cfgHandle), @@ -155,7 +155,7 @@ AsyncStoreImpl::submitCreate(qpid::broker::ConfigHandle& cfgHandle, void AsyncStoreImpl::submitDestroy(qpid::broker::ConfigHandle& cfgHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::CONFIG_DESTROY, dynamic_cast(&cfgHandle), @@ -168,7 +168,7 @@ void AsyncStoreImpl::submitCreate(qpid::broker::QueueHandle& queueHandle, const qpid::broker::DataSource* dataSrc, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::QUEUE_CREATE, dynamic_cast(&queueHandle), @@ -181,7 +181,7 @@ AsyncStoreImpl::submitCreate(qpid::broker::QueueHandle& queueHandle, void AsyncStoreImpl::submitDestroy(qpid::broker::QueueHandle& queueHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::QUEUE_DESTROY, dynamic_cast(&queueHandle), @@ -193,7 +193,7 @@ AsyncStoreImpl::submitDestroy(qpid::broker::QueueHandle& queueHandle, void AsyncStoreImpl::submitFlush(qpid::broker::QueueHandle& queueHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::QUEUE_FLUSH, dynamic_cast(&queueHandle), @@ -206,7 +206,7 @@ void AsyncStoreImpl::submitCreate(qpid::broker::EventHandle& eventHandle, const qpid::broker::DataSource* dataSrc, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::EVENT_CREATE, dynamic_cast(&eventHandle), @@ -221,7 +221,7 @@ AsyncStoreImpl::submitCreate(qpid::broker::EventHandle& eventHandle, const qpid::broker::DataSource* dataSrc, qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::EVENT_CREATE, dynamic_cast(&eventHandle), @@ -235,7 +235,7 @@ AsyncStoreImpl::submitCreate(qpid::broker::EventHandle& eventHandle, void AsyncStoreImpl::submitDestroy(qpid::broker::EventHandle& eventHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::EVENT_DESTROY, dynamic_cast(&eventHandle), @@ -248,7 +248,7 @@ void AsyncStoreImpl::submitDestroy(qpid::broker::EventHandle& eventHandle, qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::EVENT_DESTROY, dynamic_cast(&eventHandle), @@ -261,7 +261,7 @@ AsyncStoreImpl::submitDestroy(qpid::broker::EventHandle& eventHandle, void AsyncStoreImpl::submitEnqueue(qpid::broker::EnqueueHandle& enqHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::MSG_ENQUEUE, dynamic_cast(&enqHandle), @@ -274,7 +274,7 @@ void AsyncStoreImpl::submitEnqueue(qpid::broker::EnqueueHandle& enqHandle, qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::MSG_ENQUEUE, dynamic_cast(&enqHandle), @@ -287,7 +287,7 @@ AsyncStoreImpl::submitEnqueue(qpid::broker::EnqueueHandle& enqHandle, void AsyncStoreImpl::submitDequeue(qpid::broker::EnqueueHandle& enqHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::MSG_DEQUEUE, dynamic_cast(&enqHandle), @@ -300,7 +300,7 @@ void AsyncStoreImpl::submitDequeue(qpid::broker::EnqueueHandle& enqHandle, qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt) + qpid::broker::BrokerAsyncContext* brokerCtxt) { AsyncOperation* op = new AsyncOperation(AsyncOperation::MSG_DEQUEUE, dynamic_cast(&enqHandle), diff --git a/cpp/src/qpid/asyncStore/AsyncStoreImpl.h b/cpp/src/qpid/asyncStore/AsyncStoreImpl.h index c33e9030fe..7e3b3e94da 100644 --- a/cpp/src/qpid/asyncStore/AsyncStoreImpl.h +++ b/cpp/src/qpid/asyncStore/AsyncStoreImpl.h @@ -66,64 +66,64 @@ public: void submitPrepare(qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitCommit(qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitAbort(qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitCreate(qpid::broker::ConfigHandle& cfgHandle, const qpid::broker::DataSource* dataSrc, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitDestroy(qpid::broker::ConfigHandle& cfgHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitCreate(qpid::broker::QueueHandle& queueHandle, const qpid::broker::DataSource* dataSrc, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitDestroy(qpid::broker::QueueHandle& queueHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitFlush(qpid::broker::QueueHandle& queueHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitCreate(qpid::broker::EventHandle& eventHandle, const qpid::broker::DataSource* dataSrc, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitCreate(qpid::broker::EventHandle& eventHandle, const qpid::broker::DataSource* dataSrc, qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitDestroy(qpid::broker::EventHandle& eventHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitDestroy(qpid::broker::EventHandle& eventHandle, qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitEnqueue(qpid::broker::EnqueueHandle& enqHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitEnqueue(qpid::broker::EnqueueHandle& enqHandle, qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitDequeue(qpid::broker::EnqueueHandle& enqHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); void submitDequeue(qpid::broker::EnqueueHandle& enqHandle, qpid::broker::TxnHandle& txnHandle, qpid::broker::ResultCallback resultCb, - qpid::broker::BrokerContext* brokerCtxt); + qpid::broker::BrokerAsyncContext* brokerCtxt); // Legacy - Restore FTD message, is NOT async! virtual int loadContent(qpid::broker::MessageHandle& msgHandle, diff --git a/cpp/src/qpid/asyncStore/OperationQueue.cpp b/cpp/src/qpid/asyncStore/OperationQueue.cpp index 298d6d3061..1e52eb3612 100644 --- a/cpp/src/qpid/asyncStore/OperationQueue.cpp +++ b/cpp/src/qpid/asyncStore/OperationQueue.cpp @@ -23,7 +23,7 @@ #include "OperationQueue.h" -#include "qpid/broker/BrokerContext.h" +#include "qpid/broker/BrokerAsyncContext.h" namespace qpid { namespace asyncStore { diff --git a/cpp/src/qpid/broker/AsyncStore.h b/cpp/src/qpid/broker/AsyncStore.h index af9b7be601..15e9120edb 100644 --- a/cpp/src/qpid/broker/AsyncStore.h +++ b/cpp/src/qpid/broker/AsyncStore.h @@ -32,7 +32,7 @@ namespace qpid { namespace broker { // Defined by broker, implements qpid::messaging::Handle-type template to hide ref counting: -class BrokerContext; +class BrokerAsyncContext; // Subclassed by broker: class DataSource { @@ -60,7 +60,7 @@ struct AsyncResult const std::string& errMsg); void destroy(); }; -typedef void (*ResultCallback)(const AsyncResult*, BrokerContext*); +typedef void (*ResultCallback)(const AsyncResult*, BrokerAsyncContext*); // Subclassed by store: class AsyncStore { @@ -80,26 +80,26 @@ public: // Store async interface - virtual void submitPrepare(TxnHandle&, ResultCallback, BrokerContext*) = 0; // Distributed txns only - virtual void submitCommit(TxnHandle&, ResultCallback, BrokerContext*) = 0; - virtual void submitAbort(TxnHandle&, ResultCallback, BrokerContext*) = 0; + virtual void submitPrepare(TxnHandle&, ResultCallback, BrokerAsyncContext*) = 0; // Distributed txns only + virtual void submitCommit(TxnHandle&, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitAbort(TxnHandle&, ResultCallback, BrokerAsyncContext*) = 0; - virtual void submitCreate(ConfigHandle&, const DataSource*, ResultCallback, BrokerContext*) = 0; - virtual void submitDestroy(ConfigHandle&, ResultCallback, BrokerContext*) = 0; + virtual void submitCreate(ConfigHandle&, const DataSource*, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitDestroy(ConfigHandle&, ResultCallback, BrokerAsyncContext*) = 0; - virtual void submitCreate(QueueHandle&, const DataSource*, ResultCallback, BrokerContext*) = 0; - virtual void submitDestroy(QueueHandle&, ResultCallback, BrokerContext*) = 0; - virtual void submitFlush(QueueHandle&, ResultCallback, BrokerContext*) = 0; + virtual void submitCreate(QueueHandle&, const DataSource*, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitDestroy(QueueHandle&, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitFlush(QueueHandle&, ResultCallback, BrokerAsyncContext*) = 0; - virtual void submitCreate(EventHandle&, const DataSource*, ResultCallback, BrokerContext*) = 0; - virtual void submitCreate(EventHandle&, const DataSource*, TxnHandle&, ResultCallback, BrokerContext*) = 0; - virtual void submitDestroy(EventHandle&, ResultCallback, BrokerContext*) = 0; - virtual void submitDestroy(EventHandle&, TxnHandle&, ResultCallback, BrokerContext*) = 0; + virtual void submitCreate(EventHandle&, const DataSource*, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitCreate(EventHandle&, const DataSource*, TxnHandle&, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitDestroy(EventHandle&, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitDestroy(EventHandle&, TxnHandle&, ResultCallback, BrokerAsyncContext*) = 0; - virtual void submitEnqueue(EnqueueHandle&, ResultCallback, BrokerContext*) = 0; - virtual void submitEnqueue(EnqueueHandle&, TxnHandle&, ResultCallback, BrokerContext*) = 0; - virtual void submitDequeue(EnqueueHandle&, ResultCallback, BrokerContext*) = 0; - virtual void submitDequeue(EnqueueHandle&, TxnHandle&, ResultCallback, BrokerContext*) = 0; + virtual void submitEnqueue(EnqueueHandle&, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitEnqueue(EnqueueHandle&, TxnHandle&, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitDequeue(EnqueueHandle&, ResultCallback, BrokerAsyncContext*) = 0; + virtual void submitDequeue(EnqueueHandle&, TxnHandle&, ResultCallback, BrokerAsyncContext*) = 0; // Legacy - Restore FTD message, is NOT async! virtual int loadContent(MessageHandle&, QueueHandle&, char* data, uint64_t offset, const uint64_t length) = 0; diff --git a/cpp/src/qpid/broker/BrokerAsyncContext.h b/cpp/src/qpid/broker/BrokerAsyncContext.h new file mode 100644 index 0000000000..38d53a84f1 --- /dev/null +++ b/cpp/src/qpid/broker/BrokerAsyncContext.h @@ -0,0 +1,15 @@ +#ifndef qpid_broker_BrokerContext_hpp_ +#define qpid_broker_BrokerContext_hpp_ + +namespace qpid { +namespace broker { + +class BrokerAsyncContext +{ +public: + virtual ~BrokerAsyncContext() {} +}; + +}} // namespace qpid::broker + +#endif // qpid_broker_BrokerContext_hpp_ diff --git a/cpp/src/qpid/broker/BrokerContext.h b/cpp/src/qpid/broker/BrokerContext.h deleted file mode 100644 index 53fe367ab4..0000000000 --- a/cpp/src/qpid/broker/BrokerContext.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef qpid_broker_BrokerContext_hpp_ -#define qpid_broker_BrokerContext_hpp_ - -namespace qpid { -namespace broker { - -class BrokerContext -{ -public: - virtual ~BrokerContext() {} -}; - -}} // namespace qpid::broker - -#endif // qpid_broker_BrokerContext_hpp_ diff --git a/cpp/src/tests/CMakeLists.txt b/cpp/src/tests/CMakeLists.txt index c9b4538b1d..2bce8c058e 100644 --- a/cpp/src/tests/CMakeLists.txt +++ b/cpp/src/tests/CMakeLists.txt @@ -379,12 +379,12 @@ endif (UNIX) # Async store perf test (asyncPerf) set (asyncStorePerf_SOURCES - storePerftools/asyncPerf/MessageContext.cpp + storePerftools/asyncPerf/MessageAsyncContext.cpp storePerftools/asyncPerf/MockPersistableMessage.cpp storePerftools/asyncPerf/MockPersistableQueue.cpp storePerftools/asyncPerf/MockTransactionContext.cpp storePerftools/asyncPerf/PerfTest.cpp - storePerftools/asyncPerf/QueueContext.cpp + storePerftools/asyncPerf/QueueAsyncContext.cpp storePerftools/asyncPerf/QueuedMessage.cpp storePerftools/asyncPerf/TestOptions.cpp storePerftools/asyncPerf/TestResult.cpp diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp new file mode 100644 index 0000000000..d88b6570a1 --- /dev/null +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * \file MessageContext.cpp + */ + +#include "MessageAsyncContext.h" + +namespace tests { +namespace storePerftools { +namespace asyncPerf { + +MessageContext::MessageContext(MockPersistableMessage::shared_ptr msg, + const qpid::asyncStore::AsyncOperation::opCode op, + MockPersistableQueue* q) : + m_msg(msg), + m_op(op), + m_q(q) +{ + assert(m_msg.get() != 0); + assert(m_q != 0); +} + +MessageContext::~MessageContext() +{} + +qpid::asyncStore::AsyncOperation::opCode +MessageContext::getOpCode() const +{ + return m_op; +} + +const char* +MessageContext::getOpStr() const +{ + return qpid::asyncStore::AsyncOperation::getOpStr(m_op); +} + +MockPersistableMessage::shared_ptr +MessageContext::getMessage() const +{ + return m_msg; +} + +MockPersistableQueue* +MessageContext::getQueue() const +{ + return m_q; +} + +void +MessageContext::destroy() +{ + delete this; +} + +}}} // namespace tests::storePerftools::asyncPerf diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h new file mode 100644 index 0000000000..3a47b4dbe8 --- /dev/null +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * \file MessageContext.h + */ + +#ifndef tests_storePerfTools_asyncPerf_MessageContext_h_ +#define tests_storePerfTools_asyncPerf_MessageContext_h_ + +#include "MockPersistableMessage.h" + +#include "qpid/asyncStore/AsyncOperation.h" +#include "qpid/broker/BrokerAsyncContext.h" + +namespace tests { +namespace storePerftools { +namespace asyncPerf { + +class MessageContext : public qpid::broker::BrokerAsyncContext +{ +public: + MessageContext(MockPersistableMessage::shared_ptr msg, + const qpid::asyncStore::AsyncOperation::opCode op, + MockPersistableQueue* q); + virtual ~MessageContext(); + qpid::asyncStore::AsyncOperation::opCode getOpCode() const; + const char* getOpStr() const; + MockPersistableMessage::shared_ptr getMessage() const; + MockPersistableQueue* getQueue() const; + void destroy(); +protected: + MockPersistableMessage::shared_ptr m_msg; + const qpid::asyncStore::AsyncOperation::opCode m_op; + MockPersistableQueue* m_q; +}; + +}}} // namespace tests::storePerftools::asyncPerf + +#endif // tests_storePerfTools_asyncPerf_MessageContext_h_ diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/MessageContext.cpp deleted file mode 100644 index 3d18213c7d..0000000000 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageContext.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * \file MessageContext.cpp - */ - -#include "MessageContext.h" - -namespace tests { -namespace storePerftools { -namespace asyncPerf { - -MessageContext::MessageContext(MockPersistableMessage::shared_ptr msg, - const qpid::asyncStore::AsyncOperation::opCode op, - MockPersistableQueue* q) : - m_msg(msg), - m_op(op), - m_q(q) -{ - assert(m_msg.get() != 0); - assert(m_q != 0); -} - -MessageContext::~MessageContext() -{} - -qpid::asyncStore::AsyncOperation::opCode -MessageContext::getOpCode() const -{ - return m_op; -} - -const char* -MessageContext::getOpStr() const -{ - return qpid::asyncStore::AsyncOperation::getOpStr(m_op); -} - -MockPersistableMessage::shared_ptr -MessageContext::getMessage() const -{ - return m_msg; -} - -MockPersistableQueue* -MessageContext::getQueue() const -{ - return m_q; -} - -void -MessageContext::destroy() -{ - delete this; -} - -}}} // namespace tests::storePerftools::asyncPerf diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageContext.h b/cpp/src/tests/storePerftools/asyncPerf/MessageContext.h deleted file mode 100644 index 49a00fa356..0000000000 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageContext.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * \file MessageContext.h - */ - -#ifndef tests_storePerfTools_asyncPerf_MessageContext_h_ -#define tests_storePerfTools_asyncPerf_MessageContext_h_ - -#include "MockPersistableMessage.h" - -namespace tests { -namespace storePerftools { -namespace asyncPerf { - -class MessageContext : public qpid::broker::BrokerContext -{ -public: - MessageContext(MockPersistableMessage::shared_ptr msg, - const qpid::asyncStore::AsyncOperation::opCode op, - MockPersistableQueue* q); - virtual ~MessageContext(); - qpid::asyncStore::AsyncOperation::opCode getOpCode() const; - const char* getOpStr() const; - MockPersistableMessage::shared_ptr getMessage() const; - MockPersistableQueue* getQueue() const; - void destroy(); -protected: - MockPersistableMessage::shared_ptr m_msg; - const qpid::asyncStore::AsyncOperation::opCode m_op; - MockPersistableQueue* m_q; -}; - -}}} // namespace tests::storePerftools::asyncPerf - -#endif // tests_storePerfTools_asyncPerf_MessageContext_h_ diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp index 564d133c76..e89a98d02d 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp @@ -23,7 +23,7 @@ #include "MockPersistableMessage.h" -#include "MessageContext.h" +#include "MessageAsyncContext.h" #include "MockPersistableQueue.h" // debug statements in enqueueComplete() and dequeueComplete() #include "qpid/asyncStore/AsyncStoreImpl.h" @@ -48,7 +48,7 @@ MockPersistableMessage::~MockPersistableMessage() // static void MockPersistableMessage::handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc) + qpid::broker::BrokerAsyncContext* bc) { if (bc) { MessageContext* mc = dynamic_cast(bc); diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h index 83ef189f9e..c98bb8e843 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h @@ -24,14 +24,10 @@ #ifndef tests_storePerftools_asyncPerf_MockPersistableMessage_h_ #define tests_storePerftools_asyncPerf_MockPersistableMessage_h_ -#include "qpid/asyncStore/AsyncOperation.h" #include "qpid/broker/AsyncStore.h" // qpid::broker::DataSource -#include "qpid/broker/BrokerContext.h" #include "qpid/broker/MessageHandle.h" #include "qpid/broker/PersistableMessage.h" -#include // uint32_t - namespace qpid { namespace asyncStore { class AsyncStoreImpl; @@ -44,7 +40,7 @@ namespace asyncPerf { class MessageContext; class MockPersistableQueue; -class MockPersistableMessage: public qpid::broker::PersistableMessage, qpid::broker::DataSource +class MockPersistableMessage: public qpid::broker::PersistableMessage, public qpid::broker::DataSource { public: typedef boost::shared_ptr shared_ptr; @@ -55,7 +51,7 @@ public: const bool persistent = true); virtual ~MockPersistableMessage(); static void handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc); + qpid::broker::BrokerAsyncContext* bc); qpid::broker::MessageHandle& getHandle(); // Interface Persistable diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp index e607649cc7..ede0830045 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp @@ -23,14 +23,15 @@ #include "MockPersistableQueue.h" -#include "MessageContext.h" +#include "MessageAsyncContext.h" #include "MockPersistableMessage.h" #include "MockTransactionContext.h" -#include "QueueContext.h" +#include "QueueAsyncContext.h" #include "QueuedMessage.h" #include "TestOptions.h" #include "qpid/asyncStore/AsyncStoreImpl.h" +#include "qpid/broker/BrokerAsyncContext.h" #include "qpid/broker/EnqueueHandle.h" namespace tests { @@ -65,10 +66,10 @@ MockPersistableQueue::~MockPersistableQueue() // static void MockPersistableQueue::handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc) + qpid::broker::BrokerAsyncContext* bc) { if (bc && res) { - QueueContext* qc = dynamic_cast(bc); + QueueAsyncContext* qc = dynamic_cast(bc); if (res->errNo) { // TODO: Handle async failure here std::cerr << "Queue name=\"" << qc->getQueue()->m_name << "\": Operation " << qc->getOpStr() << ": failure " @@ -108,7 +109,7 @@ MockPersistableQueue::asyncStoreCreate() m_store->submitCreate(m_queueHandle, this, &handleAsyncResult, - new QueueContext(this, qpid::asyncStore::AsyncOperation::QUEUE_CREATE)); + new QueueAsyncContext(this, qpid::asyncStore::AsyncOperation::QUEUE_CREATE)); } void @@ -116,7 +117,7 @@ MockPersistableQueue::asyncStoreDestroy() { m_store->submitDestroy(m_queueHandle, &handleAsyncResult, - new QueueContext(this, qpid::asyncStore::AsyncOperation::QUEUE_DESTROY)); + new QueueAsyncContext(this, qpid::asyncStore::AsyncOperation::QUEUE_DESTROY)); } void* @@ -140,11 +141,11 @@ MockPersistableQueue::runEnqueues() m_store->submitEnqueue(enqHandle, txn->getHandle(), &MockPersistableMessage::handleAsyncResult, - dynamic_cast(msgCtxt)); + dynamic_cast(msgCtxt)); } else { m_store->submitEnqueue(enqHandle, &MockPersistableMessage::handleAsyncResult, - dynamic_cast(msgCtxt)); + dynamic_cast(msgCtxt)); } QueuedMessagePtr qm(new QueuedMessage(msg, enqHandle, txn)); push(qm); @@ -177,7 +178,7 @@ MockPersistableQueue::runDequeues() pop(qm); if (qm.get()) { qpid::broker::EnqueueHandle enqHandle = qm->getEnqueueHandle(); - qpid::broker::BrokerContext* bc = new MessageContext(qm->getMessage(), + qpid::broker::BrokerAsyncContext* bc = new MessageContext(qm->getMessage(), qpid::asyncStore::AsyncOperation::MSG_DEQUEUE, this); if (useTxn) { @@ -277,7 +278,7 @@ MockPersistableQueue::write(char* target) // protected void -MockPersistableQueue::createComplete(const QueueContext* qc) +MockPersistableQueue::createComplete(const QueueAsyncContext* qc) { //std::cout << "~~~~~ Queue name=\"" << qc->m_q->getName() << "\": createComplete()" << std::endl << std::flush; assert(qc->getQueue().get() == this); @@ -285,7 +286,7 @@ MockPersistableQueue::createComplete(const QueueContext* qc) // protected void -MockPersistableQueue::flushComplete(const QueueContext* qc) +MockPersistableQueue::flushComplete(const QueueAsyncContext* qc) { //std::cout << "~~~~~ Queue name=\"" << qc->m_q->getName() << "\": flushComplete()" << std::endl << std::flush; assert(qc->getQueue().get() == this); @@ -293,7 +294,7 @@ MockPersistableQueue::flushComplete(const QueueContext* qc) // protected void -MockPersistableQueue::destroyComplete(const QueueContext* qc) +MockPersistableQueue::destroyComplete(const QueueAsyncContext* qc) { //std::cout << "~~~~~ Queue name=\"" << qc->m_q->getName() << "\": destroyComplete()" << std::endl << std::flush; assert(qc->getQueue().get() == this); diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.h b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.h index 3867cad08d..2d7b1f1c4e 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.h @@ -24,16 +24,13 @@ #ifndef tests_storePerftools_asyncPerf_MockPersistableQueue_h_ #define tests_storePerftools_asyncPerf_MockPersistableQueue_h_ -#include "qpid/asyncStore/AsyncOperation.h" #include "qpid/broker/AsyncStore.h" // qpid::broker::DataSource -#include "qpid/broker/BrokerContext.h" #include "qpid/broker/PersistableQueue.h" #include "qpid/broker/QueueHandle.h" #include "qpid/sys/Condition.h" #include "qpid/sys/Mutex.h" #include -#include #include namespace qpid { @@ -48,7 +45,7 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class QueueContext; +class QueueAsyncContext; class QueuedMessage; class TestOptions; @@ -68,7 +65,7 @@ public: // --- Async functionality --- static void handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc); + qpid::broker::BrokerAsyncContext* bc); qpid::broker::QueueHandle& getHandle(); void asyncStoreCreate(); void asyncStoreDestroy(); @@ -112,9 +109,9 @@ protected: qpid::sys::Condition m_dequeueCondition; // --- Ascnc op completions (called through handleAsyncResult) --- - void createComplete(const QueueContext* qc); - void flushComplete(const QueueContext* qc); - void destroyComplete(const QueueContext* qc); + void createComplete(const QueueAsyncContext* qc); + void flushComplete(const QueueAsyncContext* qc); + void destroyComplete(const QueueAsyncContext* qc); // --- Queue functionality --- void push(QueuedMessagePtr& msg); diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp index b1a375f04c..05f06e95a1 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp @@ -27,39 +27,12 @@ #include "TransactionAsyncContext.h" #include "qpid/asyncStore/AsyncStoreImpl.h" +#include "qpid/broker/BrokerAsyncContext.h" namespace tests { namespace storePerftools { namespace asyncPerf { -// --- Inner class MockTransactionContext::QueueContext --- - -/* -MockTransactionContext::TransactionContext::TransactionContext(MockTransactionContext* tc, - const qpid::asyncStore::AsyncOperation::opCode op) : - m_tc(tc), - m_op(op) -{} - -MockTransactionContext::TransactionContext::~TransactionContext() -{} - -const char* -MockTransactionContext::TransactionContext::getOp() const -{ - return qpid::asyncStore::AsyncOperation::getOpStr(m_op); -} - -void -MockTransactionContext::TransactionContext::destroy() -{ - delete this; -} -*/ - -// --- Class MockTransactionContext --- - - MockTransactionContext::MockTransactionContext(qpid::asyncStore::AsyncStoreImpl* store, const std::string& xid) : m_store(store), @@ -76,7 +49,7 @@ MockTransactionContext::~MockTransactionContext() // static void MockTransactionContext::handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc) + qpid::broker::BrokerAsyncContext* bc) { if (bc && res) { TransactionAsyncContext* tac = dynamic_cast(bc); @@ -155,7 +128,7 @@ MockTransactionContext::abort() } m_store->submitAbort(m_txnHandle, &handleAsyncResult, - dynamic_cast(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_ABORT))); + dynamic_cast(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_ABORT))); //std::cout << "*TXN* abort: xid=" << m_txnHandle.getXid() << "; 2PC=" << (m_txnHandle.is2pc()?"T":"F") << std::endl; } @@ -174,7 +147,7 @@ MockTransactionContext::commit() } m_store->submitCommit(m_txnHandle, &handleAsyncResult, - dynamic_cast(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_COMMIT))); + dynamic_cast(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_COMMIT))); //std::cout << "*TXN* commit: xid=" << m_txnHandle.getXid() << "; 2PC=" << (m_txnHandle.is2pc()?"T":"F") << std::endl; } @@ -185,7 +158,7 @@ MockTransactionContext::localPrepare() { m_store->submitPrepare(m_txnHandle, &handleAsyncResult, - dynamic_cast(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_PREPARE))); + dynamic_cast(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_PREPARE))); //std::cout << "*TXN* localPrepare: xid=" << m_txnHandle.getXid() << "; 2PC=" << (m_txnHandle.is2pc()?"T":"F") << std::endl; } diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h b/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h index eb56645d47..2f8dd716f4 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h @@ -24,9 +24,7 @@ #ifndef tests_storePerftools_asyncPerf_MockTransactionContext_h_ #define tests_storePerftools_asyncPerf_MockTransactionContext_h_ -#include "qpid/asyncStore/AsyncOperation.h" - -#include "qpid/broker/BrokerContext.h" +#include "qpid/broker/AsyncStore.h" // qpid::broker::AsyncResult #include "qpid/broker/TransactionalStore.h" // qpid::broker::TransactionContext #include "qpid/broker/TxnHandle.h" #include "qpid/sys/Mutex.h" @@ -51,28 +49,11 @@ class MockTransactionContext : public qpid::broker::TransactionContext public: typedef boost::shared_ptr shared_ptr; - // NOTE: TransactionContext - Bad naming? This context is the async return handling context for class - // MockTransactionContext async ops. Other classes using this pattern simply use XXXContext for this class - // (e.g. QueueContext in MockPersistableQueue), but in this case it may be confusing. -/* - class TransactionContext : public qpid::broker::BrokerContext - { - public: - TransactionContext(MockTransactionContext* tc, - const qpid::asyncStore::AsyncOperation::opCode op); - virtual ~TransactionContext(); - const char* getOp() const; - void destroy(); - MockTransactionContext* m_tc; - const qpid::asyncStore::AsyncOperation::opCode m_op; - }; -*/ - MockTransactionContext(qpid::asyncStore::AsyncStoreImpl* store, const std::string& xid = std::string()); virtual ~MockTransactionContext(); static void handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc); + qpid::broker::BrokerAsyncContext* bc); qpid::broker::TxnHandle& getHandle(); bool is2pc() const; diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp new file mode 100644 index 0000000000..281fc03e2c --- /dev/null +++ b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * \file QueueContext.cpp + */ + +#include "QueueAsyncContext.h" + +namespace tests { +namespace storePerftools { +namespace asyncPerf { + +QueueAsyncContext::QueueAsyncContext(MockPersistableQueue::intrusive_ptr q, + const qpid::asyncStore::AsyncOperation::opCode op) : + qpid::broker::BrokerAsyncContext(), + m_q(q), + m_op(op) +{ + assert(m_q.get() != 0); +} + +QueueAsyncContext::~QueueAsyncContext() +{} + +qpid::asyncStore::AsyncOperation::opCode +QueueAsyncContext::getOpCode() const +{ + return m_op; +} + +const char* +QueueAsyncContext::getOpStr() const +{ + return qpid::asyncStore::AsyncOperation::getOpStr(m_op); +} + +MockPersistableQueue::intrusive_ptr +QueueAsyncContext::getQueue() const +{ + return m_q; +} + +void +QueueAsyncContext::destroy() +{ + delete this; +} + +}}} // namespace tests::storePerftools::asyncPerf diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h new file mode 100644 index 0000000000..657e80694a --- /dev/null +++ b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * \file QueueContext.h + */ + +#ifndef tests_storePerftools_asyncPerf_QueueContext_h_ +#define tests_storePerftools_asyncPerf_QueueContext_h_ + +#include "MockPersistableQueue.h" +#include "qpid/asyncStore/AsyncOperation.h" +#include "qpid/broker/BrokerAsyncContext.h" + +namespace tests { +namespace storePerftools { +namespace asyncPerf { + +class QueueAsyncContext: public qpid::broker::BrokerAsyncContext +{ +public: + QueueAsyncContext(MockPersistableQueue::intrusive_ptr q, + const qpid::asyncStore::AsyncOperation::opCode op); + virtual ~QueueAsyncContext(); + qpid::asyncStore::AsyncOperation::opCode getOpCode() const; + const char* getOpStr() const; + MockPersistableQueue::intrusive_ptr getQueue() const; + void destroy(); +protected: + MockPersistableQueue::intrusive_ptr m_q; + const qpid::asyncStore::AsyncOperation::opCode m_op; +}; + +}}} // namespace tests::storePerftools::asyncPerf + +#endif // tests_storePerftools_asyncPerf_QueueContext_h_ diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueueContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/QueueContext.cpp deleted file mode 100644 index 2b690a5d71..0000000000 --- a/cpp/src/tests/storePerftools/asyncPerf/QueueContext.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * \file QueueContext.cpp - */ - -#include "QueueContext.h" - -namespace tests { -namespace storePerftools { -namespace asyncPerf { - -QueueContext::QueueContext(MockPersistableQueue::intrusive_ptr q, - const qpid::asyncStore::AsyncOperation::opCode op) : - qpid::broker::BrokerContext(), - m_q(q), - m_op(op) -{ - assert(m_q.get() != 0); -} - -QueueContext::~QueueContext() -{} - -qpid::asyncStore::AsyncOperation::opCode -QueueContext::getOpCode() const -{ - return m_op; -} - -const char* -QueueContext::getOpStr() const -{ - return qpid::asyncStore::AsyncOperation::getOpStr(m_op); -} - -MockPersistableQueue::intrusive_ptr -QueueContext::getQueue() const -{ - return m_q; -} - -void -QueueContext::destroy() -{ - delete this; -} - -}}} // namespace tests::storePerftools::asyncPerf diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueueContext.h b/cpp/src/tests/storePerftools/asyncPerf/QueueContext.h deleted file mode 100644 index 025a9dcf4f..0000000000 --- a/cpp/src/tests/storePerftools/asyncPerf/QueueContext.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * \file QueueContext.h - */ - -#ifndef tests_storePerftools_asyncPerf_QueueContext_h_ -#define tests_storePerftools_asyncPerf_QueueContext_h_ - -#include "MockPersistableQueue.h" -#include "qpid/broker/BrokerContext.h" - -namespace tests { -namespace storePerftools { -namespace asyncPerf { - -class QueueContext: public qpid::broker::BrokerContext -{ -public: - QueueContext(MockPersistableQueue::intrusive_ptr q, - const qpid::asyncStore::AsyncOperation::opCode op); - virtual ~QueueContext(); - qpid::asyncStore::AsyncOperation::opCode getOpCode() const; - const char* getOpStr() const; - MockPersistableQueue::intrusive_ptr getQueue() const; - void destroy(); -protected: - MockPersistableQueue::intrusive_ptr m_q; - const qpid::asyncStore::AsyncOperation::opCode m_op; -}; - -}}} // namespace tests::storePerftools::asyncPerf - -#endif // tests_storePerftools_asyncPerf_QueueContext_h_ diff --git a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp index c0c94e3a18..118707b3d3 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp @@ -6,7 +6,7 @@ namespace asyncPerf { TransactionAsyncContext::TransactionAsyncContext(MockTransactionContext* tc, const qpid::asyncStore::AsyncOperation::opCode op): - qpid::broker::BrokerContext(), + qpid::broker::BrokerAsyncContext(), m_tc(tc), m_op(op) { diff --git a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h index 092958a93b..3bce23046e 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h @@ -2,13 +2,14 @@ #define tests_storePerftools_asyncPerf_TransactionAsyncContext_h_ #include "MockTransactionContext.h" -#include "qpid/broker/BrokerContext.h" +#include "qpid/asyncStore/AsyncOperation.h" +#include "qpid/broker/BrokerAsyncContext.h" namespace tests { namespace storePerftools { namespace asyncPerf { -class TransactionAsyncContext: public qpid::broker::BrokerContext { +class TransactionAsyncContext: public qpid::broker::BrokerAsyncContext { public: TransactionAsyncContext(MockTransactionContext* tc, const qpid::asyncStore::AsyncOperation::opCode op); -- cgit v1.2.1