00001 #ifndef __XRDFILECACHE_IO_ENTIRE_FILE_HH__ 00002 #define __XRDFILECACHE_IO_ENTIRE_FILE_HH__ 00003 //---------------------------------------------------------------------------------- 00004 // Copyright (c) 2014 by Board of Trustees of the Leland Stanford, Jr., University 00005 // Author: Alja Mrak-Tadel, Matevz Tadel, Brian Bockelman 00006 //---------------------------------------------------------------------------------- 00007 // XRootD is free software: you can redistribute it and/or modify 00008 // it under the terms of the GNU Lesser General Public License as published by 00009 // the Free Software Foundation, either version 3 of the License, or 00010 // (at your option) any later version. 00011 // 00012 // XRootD is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public License 00018 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 00019 //---------------------------------------------------------------------------------- 00020 00021 #include <string> 00022 00023 #include "XrdSys/XrdSysPthread.hh" 00024 #include "XrdFileCacheIO.hh" 00025 #include "XrdFileCache.hh" 00026 #include "XrdFileCacheStats.hh" 00027 #include "XrdFileCacheFile.hh" 00028 00029 class XrdSysError; 00030 class XrdOssDF; 00031 class XfcStats; 00032 class XrdOucIOVec; 00033 00034 namespace XrdFileCache 00035 { 00036 //---------------------------------------------------------------------------- 00039 //---------------------------------------------------------------------------- 00040 class IOEntireFile : public IO 00041 { 00042 public: 00043 //------------------------------------------------------------------------ 00045 //------------------------------------------------------------------------ 00046 IOEntireFile(XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &cache); 00047 00048 //------------------------------------------------------------------------ 00050 //------------------------------------------------------------------------ 00051 ~IOEntireFile(); 00052 00053 //------------------------------------------------------------------------ 00055 //------------------------------------------------------------------------ 00056 bool HasFile() const { return m_file != 0; } 00057 00058 //--------------------------------------------------------------------- 00066 //--------------------------------------------------------------------- 00067 using XrdOucCacheIO2::Read; 00068 00069 virtual int Read(char *Buffer, long long Offset, int Length); 00070 00071 //--------------------------------------------------------------------- 00078 //--------------------------------------------------------------------- 00079 using XrdOucCacheIO2::ReadV; 00080 00081 virtual int ReadV(const XrdOucIOVec *readV, int n); 00082 00083 //--------------------------------------------------------------------- 00087 //--------------------------------------------------------------------- 00088 virtual XrdOucCacheIO* Detach(); 00089 00092 virtual bool ioActive(); 00093 00094 virtual int Fstat(struct stat &sbuff); 00095 00096 virtual long long FSize(); 00097 00098 private: 00099 XrdSysMutex m_mutex; 00100 File *m_file; 00101 struct stat *m_localStat; 00102 int initCachedStat(const char* path); 00103 }; 00104 00105 } 00106 #endif 00107