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 XrdOucIOVec;
32 
33 namespace XrdPfc
34 {
35 //----------------------------------------------------------------------------
38 //----------------------------------------------------------------------------
39 class IOEntireFile : public IO
40 {
41 public:
43 
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 
XrdPfc::IOEntireFile::initCachedStat
int initCachedStat(const char *path)
XrdOucCacheIO
Definition: XrdOucCache.hh:105
XrdSysPthread.hh
XrdPfc::Cache
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdPfc.hh:264
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:139
XrdPfc::IOEntireFile::Fstat
virtual int Fstat(struct stat &sbuff)
XrdOssDF
Definition: XrdOss.hh:63
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:40
XrdPfc::IOEntireFile::m_file
File * m_file
Definition: XrdPfcIOEntireFile.hh:91
XrdPfcFile.hh
XrdPfc::IOEntireFile::FSize
virtual long long FSize()
XrdPfc::IOEntireFile::HasFile
bool HasFile() const
Check if File was opened successfully.
Definition: XrdPfcIOEntireFile.hh:49
XrdPfcIO.hh
XrdPfc::IOEntireFile::~IOEntireFile
~IOEntireFile()
XrdPfc.hh
XrdPfc::IOEntireFile::m_localStat
struct stat * m_localStat
Definition: XrdPfcIOEntireFile.hh:92
stat
#define stat(a, b)
Definition: XrdPosix.hh:96
XrdPfc
Definition: XrdPfc.hh:41
XrdPfc::IOEntireFile::IOEntireFile
IOEntireFile(XrdOucCacheIO *io, Cache &cache)
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::Update
virtual void Update(XrdOucCacheIO &iocp)
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)