00001 /* 00002 * 00003 * Licensed to the Apache Software Foundation (ASF) under one 00004 * or more contributor license agreements. See the NOTICE file 00005 * distributed with this work for additional information 00006 * regarding copyright ownership. The ASF licenses this file 00007 * to you under the Apache License, Version 2.0 (the 00008 * "License"); you may not use this file except in compliance 00009 * with the License. You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, 00014 * software distributed under the License is distributed on an 00015 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 00016 * KIND, either express or implied. See the License for the 00017 * specific language governing permissions and limitations 00018 * under the License. 00019 * 00020 */ 00021 #ifndef _MessageStoreModule_ 00022 #define _MessageStoreModule_ 00023 00024 #include "BrokerMessage.h" 00025 #include "MessageStore.h" 00026 #include "BrokerQueue.h" 00027 #include "RecoveryManager.h" 00028 #include "qpid/sys/Module.h" 00029 00030 namespace qpid { 00031 namespace broker { 00032 00036 class MessageStoreModule : public MessageStore 00037 { 00038 qpid::sys::Module<MessageStore> store; 00039 public: 00040 MessageStoreModule(const std::string& name); 00041 00042 std::auto_ptr<TransactionContext> begin(); 00043 std::auto_ptr<TPCTransactionContext> begin(const std::string& xid); 00044 void prepare(TPCTransactionContext& txn); 00045 void commit(TransactionContext& txn); 00046 void abort(TransactionContext& txn); 00047 void collectPreparedXids(std::set<std::string>& xids); 00048 00049 void create(const PersistableQueue& queue); 00050 void destroy(const PersistableQueue& queue); 00051 void create(const PersistableExchange& exchange); 00052 void destroy(const PersistableExchange& exchange); 00053 void recover(RecoveryManager& queues); 00054 void stage(PersistableMessage& msg); 00055 void destroy(PersistableMessage& msg); 00056 void appendContent(PersistableMessage& msg, const std::string& data); 00057 void loadContent(PersistableMessage& msg, std::string& data, uint64_t offset, uint32_t length); 00058 void enqueue(TransactionContext* ctxt, PersistableMessage& msg, const PersistableQueue& queue); 00059 void dequeue(TransactionContext* ctxt, PersistableMessage& msg, const PersistableQueue& queue); 00060 00061 ~MessageStoreModule(){} 00062 }; 00063 00064 } 00065 } 00066 00067 00068 #endif