XRootD
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 "XrdPfcIO.hh"
24 #include "XrdPfc.hh"
25 #include "XrdPfcStats.hh"
26 #include "XrdPfcFile.hh"
27 
28 class XrdSysError;
29 class XrdOssDF;
30 class XrdOucIOVec;
31 
32 namespace XrdPfc
33 {
34 //----------------------------------------------------------------------------
37 //----------------------------------------------------------------------------
38 class IOFile : public IO
39 {
40 public:
41  IOFile(XrdOucCacheIO *io, Cache &cache);
42 
43  ~IOFile();
44 
45  //------------------------------------------------------------------------
47  //------------------------------------------------------------------------
48  bool HasFile() const { return m_file != 0; }
49 
50  //---------------------------------------------------------------------
52  //---------------------------------------------------------------------
53  int Read(char *buff, long long off, int size) override;
54  void Read(XrdOucCacheIOCB &iocb, char *buff, long long off, int size) override;
55  void pgRead(XrdOucCacheIOCB &iocb, char *buff, long long off, int size,
56  std::vector<uint32_t> &csvec, uint64_t opts=0, int *csfix=0) override;
58 
59  //---------------------------------------------------------------------
61  //---------------------------------------------------------------------
62  int ReadV(const XrdOucIOVec *readV, int n) override;
63  void ReadV(XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int n) override;
64 
65  void Update(XrdOucCacheIO &iocp) override;
66 
69  bool ioActive() override;
70 
73  void DetachFinalize() override;
74 
75  int Fstat(struct stat &sbuff) override;
76 
77  long long FSize() override;
78 
79 private:
80  File *m_file;
81 
82  int ReadBegin(char *buff, long long off, int size, ReadReqRH *rh);
83  int ReadEnd(int retval, ReadReqRH *rh);
84 
85  int ReadVBegin(const XrdOucIOVec *readV, int n, ReadReqRH *rh);
86  int ReadVEnd(int retval, ReadReqRH *rh);
87 
88  int initialStat(struct stat &sbuff);
89 };
90 
91 }
92 #endif
93 
int stat(const char *path, struct stat *buf)
struct myOpts opts
virtual int pgRead(char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
Definition: XrdOucCache.cc:39
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdPfc.hh:152
Downloads original file into a single file on local disk. Handles read requests as they come along.
Definition: XrdPfcIOFile.hh:39
bool HasFile() const
Check if File was opened successfully.
Definition: XrdPfcIOFile.hh:48
void Update(XrdOucCacheIO &iocp) override
void DetachFinalize() override
Abstract virtual method of XrdPfc::IO Called to destruct the IO object after it is no longer used.
int Read(char *buff, long long off, int size) override
Pass Read request to the corresponding File object.
int Fstat(struct stat &sbuff) override
Definition: XrdPfcIOFile.cc:52
bool ioActive() override
Abstract virtual method of XrdPfc::IO Called to check if destruction needs to be done in a separate t...
int ReadV(const XrdOucIOVec *readV, int n) override
Pass ReadV request to the corresponding File object.
long long FSize() override
Definition: XrdPfcIOFile.cc:66
IOFile(XrdOucCacheIO *io, Cache &cache)
Definition: XrdPfcIOFile.cc:36
virtual int pgRead(char *buff, long long offs, int rdlen, std::vector< uint32_t > &csvec, uint64_t opts=0, int *csfix=0)
Definition: XrdOucCache.cc:39
Base cache-io class that implements some XrdOucCacheIO abstract methods.
Definition: XrdPfcIO.hh:16
Definition: XrdPfc.hh:41