xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XrdPfcIOFile.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 IOFile : public IO
40 {
41 public:
42  IOFile(XrdOucCacheIO *io, Cache &cache);
43 
44  ~IOFile();
45 
46  //------------------------------------------------------------------------
48  //------------------------------------------------------------------------
49  bool HasFile() const { return m_file != 0; }
50 
51  //---------------------------------------------------------------------
53  //---------------------------------------------------------------------
54  int Read(char *buff, long long off, int size) override;
55  void Read(XrdOucCacheIOCB &iocb, char *buff, long long off, int size) override;
56  void pgRead(XrdOucCacheIOCB &iocb, char *buff, long long off, int size,
57  std::vector<uint32_t> &csvec, uint64_t opts=0, int *csfix=0) override;
59 
60  //---------------------------------------------------------------------
62  //---------------------------------------------------------------------
63  int ReadV(const XrdOucIOVec *readV, int n) override;
64  void ReadV(XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int n) override;
65 
66  void Update(XrdOucCacheIO &iocp) override;
67 
70  bool ioActive() override;
71 
74  void DetachFinalize() override;
75 
76  int Fstat(struct stat &sbuff) override;
77 
78  long long FSize() override;
79 
80 private:
82 
83  int ReadBegin(char *buff, long long off, int size, ReadReqRH *rh);
84  int ReadEnd(int retval, ReadReqRH *rh);
85 
86  int ReadVBegin(const XrdOucIOVec *readV, int n, ReadReqRH *rh);
87  int ReadVEnd(int retval, ReadReqRH *rh);
88 
89  struct stat *m_localStat;
90  int initCachedStat();
91 
92 
93 };
94 
95 }
96 #endif
97 
int initCachedStat()
File * m_file
Definition: XrdPfcIOFile.hh:81
bool ioActive() override
Abstract virtual method of XrdPfc::IO Called to check if destruction needs to be done in a separate t...
Base cache-io class that implements some XrdOucCacheIO abstract methods.
Definition: XrdPfcIO.hh:17
Definition: XrdOucCache.hh:104
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdPfc.hh:263
IOFile(XrdOucCacheIO *io, Cache &cache)
Downloads original file into a single file on local disk. Handles read requests as they come along...
Definition: XrdPfcIOFile.hh:39
int ReadV(const XrdOucIOVec *readV, int n) override
Pass ReadV request to the corresponding File object.
Definition: XrdSysError.hh:89
int ReadBegin(char *buff, long long off, int size, ReadReqRH *rh)
Definition: XrdPfcFile.hh:60
int Fstat(struct stat &sbuff) override
void pgRead(XrdOucCacheIOCB &iocb, char *buff, long long off, int size, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0) override
bool HasFile() const
Check if File was opened successfully.
Definition: XrdPfcIOFile.hh:49
long long FSize() override
Definition: XrdOucIOVec.hh:40
Definition: XrdOucCache.hh:52
virtual int pgRead(char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
#define stat(a, b)
Definition: XrdPosix.hh:96
Definition: XrdPfcFile.hh:212
int ReadEnd(int retval, ReadReqRH *rh)
struct stat * m_localStat
Definition: XrdPfcIOFile.hh:89
Definition: XrdOss.hh:62
int ReadVBegin(const XrdOucIOVec *readV, int n, ReadReqRH *rh)
int ReadVEnd(int retval, ReadReqRH *rh)
void DetachFinalize() override
Abstract virtual method of XrdPfc::IO Called to destruct the IO object after it is no longer used...
void Update(XrdOucCacheIO &iocp) override
int Read(char *buff, long long off, int size) override
Pass Read request to the corresponding File object.