xrootd
XrdPfcIOEntireFile.hh
Go to the documentation of this file.
1 #ifndef __XRDPFC_IO_ENTIRE_FILE_HH__
2 #define __XRDPFC_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 "XrdPfcIO.hh"
25 #include "XrdPfc.hh"
26 #include "XrdPfcStats.hh"
27 #include "XrdPfcFile.hh"
28 
29 class XrdSysError;
30 class XrdOssDF;
31 class XfcStats;
32 class XrdOucIOVec;
33 
34 namespace XrdPfc
35 {
36 //----------------------------------------------------------------------------
39 //----------------------------------------------------------------------------
40 class IOEntireFile : public IO
41 {
42 public:
44 
46 
47  //------------------------------------------------------------------------
49  //------------------------------------------------------------------------
50  bool HasFile() const { return m_file != 0; }
51 
52  //---------------------------------------------------------------------
60  //---------------------------------------------------------------------
61  using XrdOucCacheIO::Read;
62 
63  virtual int Read(char *Buffer, long long Offset, int Length);
64 
65  //---------------------------------------------------------------------
72  //---------------------------------------------------------------------
74 
75  virtual int ReadV(const XrdOucIOVec *readV, int n);
76 
79  bool ioActive() /* override */;
80 
83  void DetachFinalize() /* override */;
84 
85  virtual int Fstat(struct stat &sbuff);
86 
87  virtual long long FSize();
88 
89 private:
91  struct stat *m_localStat;
92  int initCachedStat(const char* path);
93 };
94 
95 }
96 #endif
97 
XrdPfc::IOEntireFile::initCachedStat
int initCachedStat(const char *path)
XrdOucCacheIO
Definition: XrdOucCache.hh:103
XrdSysPthread.hh
XrdPfc::Cache
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdPfc.hh:281
XrdPfc::IO
Base cache-io class that implements XrdOucCacheIO abstract methods.
Definition: XrdPfcIO.hh:17
XrdOucCacheIO::Read
virtual int Read(char *buff, long long offs, int rlen)=0
XrdPfc::File
Definition: XrdPfcFile.hh:134
XrdPfc::IOEntireFile::Fstat
virtual int Fstat(struct stat &sbuff)
XrdOssDF
Definition: XrdOss.hh:62
XrdPfcStats.hh
XrdOucCacheIO::ReadV
virtual int ReadV(const XrdOucIOVec *readV, int rnum)
XrdOucIOVec
Definition: XrdOucIOVec.hh:41
XrdPfc::IOEntireFile
Downloads original file into a single file on local disk. Handles read requests as they come along.
Definition: XrdPfcIOEntireFile.hh:41
XrdPfc::IOEntireFile::m_file
File * m_file
Definition: XrdPfcIOEntireFile.hh:90
XrdPfcFile.hh
XrdPfc::IOEntireFile::FSize
virtual long long FSize()
XrdPfc::IOEntireFile::HasFile
bool HasFile() const
Check if File was opened successfully.
Definition: XrdPfcIOEntireFile.hh:50
XrdPfcIO.hh
XrdPfc::IOEntireFile::~IOEntireFile
~IOEntireFile()
XrdOucCacheStats
Definition: XrdOucCacheStats.hh:44
XrdPfc.hh
XrdPfc::IOEntireFile::m_localStat
struct stat * m_localStat
Definition: XrdPfcIOEntireFile.hh:91
XrdPfc::IOEntireFile::IOEntireFile
IOEntireFile(XrdOucCacheIO *io, XrdOucCacheStats &stats, Cache &cache)
stat
#define stat(a, b)
Definition: XrdPosix.hh:96
XrdPfc
Definition: XrdPfc.hh:46
XrdSysError
Definition: XrdSysError.hh:90
XrdPfc::IOEntireFile::ioActive
bool ioActive()
Abstract virtual method of XrdPfcIO Called to check if destruction needs to be done in a separate tas...
XrdPfc::IOEntireFile::DetachFinalize
void DetachFinalize()
Abstract virtual method of XrdPfcIO Called to destruct the IO object after it is no longer used.
XrdPfc::IOEntireFile::ReadV
virtual int ReadV(const XrdOucIOVec *readV, int n)
XrdPfc::IOEntireFile::Read
virtual int Read(char *Buffer, long long Offset, int Length)