1 /* Copyright (C) 2014 InfiniDB, Inc. 2 3 This program is free software; you can redistribute it and/or 4 modify it under the terms of the GNU General Public License 5 as published by the Free Software Foundation; version 2 of 6 the License. 7 8 This program is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License 14 along with this program; if not, write to the Free Software 15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 16 MA 02110-1301, USA. */ 17 18 #ifndef IOMANAGER_H 19 #define IOMANAGER_H 20 // $Id: iomanager.h 655 2008-07-08 16:42:54Z jrodriguez $ 21 // 22 // C++ Interface: iomanager 23 // 24 // Description: 25 // 26 // 27 // Author: Jason Rodriguez <jrodriguez@calpont.com> 28 // 29 // 30 // 31 32 /** 33 @author Jason Rodriguez <jrodriguez@calpont.com> 34 */ 35 36 #include <pthread.h> 37 #include <string> 38 39 #include "writeengine.h" 40 #include "configcpp.h" 41 #include "brm.h" 42 #include "fileblockrequestqueue.h" 43 #include "filebuffermgr.h" 44 45 namespace dbbc 46 { 47 48 class ioManager 49 { 50 51 public: 52 53 ioManager(FileBufferMgr& fbm, fileBlockRequestQueue& fbrq, int thrCount, 54 int bsPerRead); 55 //ioManager(FileBufferMgr& fbm, int thrCount); 56 ~ioManager(); readerCount()57 int readerCount() const 58 { 59 return fThreadCount; 60 } 61 fileRequest* getNextRequest(); 62 void go(void); 63 void stop(); fileBufferManager()64 FileBufferMgr& fileBufferManager() 65 { 66 return fIOMfbMgr; 67 } configPtr()68 config::Config* configPtr() 69 { 70 return fConfig; 71 } 72 BRM::LBID_t lbidLookup(BRM::LBID_t lbid, 73 BRM::VER_t verid, 74 bool vbFlag, 75 BRM::OID_t& oid, 76 uint32_t& offset); 77 void buildOidFileName(const BRM::OID_t oid, char* file_name); 78 getExtentSize()79 uint32_t getExtentSize() 80 { 81 return fdbrm.getExtentSize(); 82 } 83 84 uint32_t blocksPerRead; 85 IOTrace()86 bool IOTrace() const 87 { 88 return fIOTrace; 89 } 90 91 private: 92 93 FileBufferMgr& fIOMfbMgr; 94 fileBlockRequestQueue& fIOMRequestQueue; 95 int fThreadCount; 96 pthread_t fPoppertid; 97 pthread_t fThreadArr[256]; 98 int createReaders(); 99 config::Config* fConfig; 100 BRM::DBRM fdbrm; 101 WriteEngine::FileOp fFileOp; 102 103 // do not implement 104 ioManager(); 105 ioManager(const ioManager& iom); 106 const ioManager& operator=(const ioManager& iom); 107 bool fIOTrace; 108 }; 109 110 } 111 #endif 112 // vim:ts=4 sw=4: 113