xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 XrdOucIOVec;
32 
33 namespace XrdPfc
34 {
35 //----------------------------------------------------------------------------
38 //----------------------------------------------------------------------------
39 class IOEntireFile : public IO
40 {
41 public:
42  IOEntireFile(XrdOucCacheIO *io, Cache &cache);
43 
44  ~IOEntireFile();
45 
46  //------------------------------------------------------------------------
48  //------------------------------------------------------------------------
49  bool HasFile() const { return m_file != 0; }
50 
51  //---------------------------------------------------------------------
59  //---------------------------------------------------------------------
60  using XrdOucCacheIO::Read;
61 
62  virtual int Read(char *Buffer, long long Offset, int Length);
63 
64  //---------------------------------------------------------------------
71  //---------------------------------------------------------------------
73 
74  virtual int ReadV(const XrdOucIOVec *readV, int n);
75 
76  virtual void Update(XrdOucCacheIO &iocp);
77 
80  bool ioActive() /* override */;
81 
84  void DetachFinalize() /* override */;
85 
86  virtual int Fstat(struct stat &sbuff);
87 
88  virtual long long FSize();
89 
90 private:
92  struct stat *m_localStat;
93  int initCachedStat(const char* path);
94 };
95 
96 }
97 #endif
98 
virtual long long FSize()
Downloads original file into a single file on local disk. Handles read requests as they come along...
Definition: XrdPfcIOEntireFile.hh:39
Base cache-io class that implements XrdOucCacheIO abstract methods.
Definition: XrdPfcIO.hh:18
Definition: XrdOucCache.hh:104
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdPfc.hh:263
bool ioActive()
Abstract virtual method of XrdPfcIO Called to check if destruction needs to be done in a separate tas...
struct stat * m_localStat
Definition: XrdPfcIOEntireFile.hh:92
Definition: XrdSysError.hh:89
virtual void Update(XrdOucCacheIO &iocp)
IOEntireFile(XrdOucCacheIO *io, Cache &cache)
Definition: XrdOucIOVec.hh:40
void DetachFinalize()
Abstract virtual method of XrdPfcIO Called to destruct the IO object after it is no longer used...
virtual int ReadV(const XrdOucIOVec *readV, int n)
virtual int Read(char *Buffer, long long Offset, int Length)
int initCachedStat(const char *path)
#define stat(a, b)
Definition: XrdPosix.hh:96
Definition: XrdPfcFile.hh:144
bool HasFile() const
Check if File was opened successfully.
Definition: XrdPfcIOEntireFile.hh:49
Definition: XrdOss.hh:62
virtual int ReadV(const XrdOucIOVec *readV, int rnum)
virtual int Read(char *buff, long long offs, int rlen)=0
virtual int Fstat(struct stat &sbuff)
File * m_file
Definition: XrdPfcIOEntireFile.hh:91