xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
XrdFileCacheIOEntireFile.hh
Go to the documentation of this file.
1 #ifndef __XRDFILECACHE_IO_ENTIRE_FILE_HH__
2 #define __XRDFILECACHE_IO_ENTIRE_FILE_HH__
3 //----------------------------------------------------------------------------------
4 // Copyright (c) 2014 by Board of Trustees of the Leland Stanford, Jr., University
5 // Author: Alja Mrak-Tadel, Matevz Tadel, Brian Bockelman
6 //----------------------------------------------------------------------------------
7 // XRootD is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // XRootD is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19 //----------------------------------------------------------------------------------
20 
21 #include <string>
22 
23 #include "XrdSys/XrdSysPthread.hh"
24 #include "XrdFileCacheIO.hh"
25 #include "XrdFileCache.hh"
26 #include "XrdFileCacheStats.hh"
27 #include "XrdFileCacheFile.hh"
28 
29 class XrdSysError;
30 class XrdOssDF;
31 class XfcStats;
32 class XrdOucIOVec;
33 
34 namespace XrdFileCache
35 {
36 //----------------------------------------------------------------------------
39 //----------------------------------------------------------------------------
40 class IOEntireFile : public IO
41 {
42 public:
43  //------------------------------------------------------------------------
45  //------------------------------------------------------------------------
47 
48  //------------------------------------------------------------------------
50  //------------------------------------------------------------------------
51  ~IOEntireFile();
52 
53  //------------------------------------------------------------------------
55  //------------------------------------------------------------------------
56  bool HasFile() const { return m_file != 0; }
57 
58  //---------------------------------------------------------------------
66  //---------------------------------------------------------------------
68 
69  virtual int Read(char *Buffer, long long Offset, int Length);
70 
71  //---------------------------------------------------------------------
78  //---------------------------------------------------------------------
80 
81  virtual int ReadV(const XrdOucIOVec *readV, int n);
82 
83  //---------------------------------------------------------------------
87  //---------------------------------------------------------------------
88  virtual XrdOucCacheIO* Detach();
89 
92  virtual bool ioActive();
93 
94  virtual int Fstat(struct stat &sbuff);
95 
96  virtual long long FSize();
97 
98 private:
101  struct stat *m_localStat;
102  int initCachedStat(const char* path);
103 };
104 
105 }
106 #endif
107 
virtual int Fstat(struct stat &sbuff)
virtual XrdOucCacheIO * Detach()
Definition: XrdOucCache.hh:127
virtual int Read(char *Buffer, long long Offset, int Length)
bool HasFile() const
Check if File was opened successfully.
Definition: XrdFileCacheIOEntireFile.hh:56
Definition: XrdSysError.hh:89
virtual void ReadV(XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int rnum)
Definition: XrdOucCache2.hh:125
Definition: XrdSysPthread.hh:165
Base cache-io class that implements XrdOucCacheIO abstract methods.
Definition: XrdFileCacheIO.hh:16
IOEntireFile(XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &cache)
Constructor.
virtual int ReadV(const XrdOucIOVec *readV, int n)
XrdSysMutex m_mutex
Definition: XrdFileCacheIOEntireFile.hh:99
Definition: XrdOucCache2.hh:62
Definition: XrdOucIOVec.hh:40
Downloads original file into a single file on local disk. Handles read requests as they come along...
Definition: XrdFileCacheIOEntireFile.hh:40
virtual void Read(XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
Definition: XrdOucCache2.hh:107
Definition: XrdFileCacheFile.hh:133
#define stat(a, b)
Definition: XrdPosix.hh:96
virtual bool ioActive()
Virtual method of XrdOucCacheIO. Called to check if destruction needs to be done in a separate task...
File * m_file
Definition: XrdFileCacheIOEntireFile.hh:100
Definition: XrdOss.hh:59
Definition: XrdOucCacheStats.hh:40
struct stat * m_localStat
Definition: XrdFileCacheIOEntireFile.hh:101
virtual long long FSize()
int initCachedStat(const char *path)
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdFileCache.hh:129