XRootD
XrdPfcIOFileBlock.hh
Go to the documentation of this file.
1 #ifndef __XRDPFC_IO_FILE_BLOCK_HH__
2 #define __XRDPFC_IO_FILE_BLOCK_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 #include <map>
21 #include <string>
22 
23 #include "XrdOuc/XrdOucCache.hh"
24 
25 #include "XrdPfcIO.hh"
26 
27 class XrdSysError;
28 class XrdOssDF;
29 
30 namespace XrdPfc
31 {
32 //----------------------------------------------------------------------------
36 //----------------------------------------------------------------------------
37 class IOFileBlock : public IO
38 {
39 public:
40  IOFileBlock(XrdOucCacheIO *io, Cache &cache);
41 
42  ~IOFileBlock();
43 
46  bool ioActive() override;
47 
50  void DetachFinalize() override;
51 
52  //---------------------------------------------------------------------
54  //---------------------------------------------------------------------
55  using XrdOucCacheIO::Read;
56 
57  int Read(char *Buffer, long long Offset, int Length) override;
58 
59  int Fstat(struct stat &sbuff) override;
60 
61  long long FSize() override;
62 
63  void Update(XrdOucCacheIO &iocp) override;
64 
65 private:
66  long long m_blocksize;
67  std::map<int, File*> m_blocks;
68  XrdSysMutex m_mutex;
69  struct stat *m_localStat;
70  Info m_info;
71  XrdOssDF* m_info_file;
72 
73  void GetBlockSizeFromPath();
74  int initLocalStat();
75  File* newBlockFile(long long off, int blocksize);
76  void CloseInfoFile();
77 };
78 }
79 
80 #endif
int stat(const char *path, struct stat *buf)
virtual int Read(char *buff, long long offs, int rlen)=0
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdPfc.hh:152
Downloads original file into multiple files, chunked into blocks. Only blocks that are asked for are ...
void Update(XrdOucCacheIO &iocp) override
long long FSize() override
virtual int Read(char *buff, long long offs, int rlen)=0
Pass Read request to the corresponding File object.
int Fstat(struct stat &sbuff) override
IOFileBlock(XrdOucCacheIO *io, Cache &cache)
bool ioActive() override
Abstract virtual method of XrdPfc::IO Called to check if destruction needs to be done in a separate t...
void DetachFinalize() override
Abstract virtual method of XrdPfc::IO Called to destruct the IO object after it is no longer used.
Base cache-io class that implements some XrdOucCacheIO abstract methods.
Definition: XrdPfcIO.hh:16
Status of cached file. Can be read from and written into a binary file.
Definition: XrdPfcInfo.hh:41
Definition: XrdPfc.hh:41