xrootd
XrdFileCacheIOFileBlock.hh
Go to the documentation of this file.
1 #ifndef __XRDFILECACHE_IO_FILE_BLOCK_HH__
2 #define __XRDFILECACHE_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 #include "XrdSys/XrdSysPthread.hh"
25 
26 #include "XrdFileCache.hh"
27 #include "XrdFileCachePrefetch.hh"
28 
29 class XrdSysError;
30 class XrdOssDF;
31 
32 namespace XrdFileCache
33 {
34  //----------------------------------------------------------------------------
38  //----------------------------------------------------------------------------
39  class IOFileBlock : public IO
40  {
41  public:
42  //------------------------------------------------------------------------
44  //------------------------------------------------------------------------
45  IOFileBlock(XrdOucCacheIO &io, XrdOucCacheStats &stats, Cache &cache);
46 
47  //------------------------------------------------------------------------
49  //------------------------------------------------------------------------
51 
52  //---------------------------------------------------------------------
56  //---------------------------------------------------------------------
57  virtual XrdOucCacheIO *Detach();
58 
59  //---------------------------------------------------------------------
61  //---------------------------------------------------------------------
62  virtual int Read(char *Buffer, long long Offset, int Length);
63 
66  virtual bool ioActive();
67 
68  private:
69  long long m_blocksize;
70  std::map<int, Prefetch*> m_blocks;
72 
73  void GetBlockSizeFromPath();
74  Prefetch* newBlockPrefetcher(long long off, int blocksize, XrdOucCacheIO* io);
75  };
76 }
77 
78 #endif
Downloads original file into multiple files, chunked into blocks. Only blocks that are asked for are ...
Definition: XrdFileCacheIOFileBlock.hh:39
virtual XrdOucCacheIO * Detach()
Definition: XrdFileCache.hh:30
Definition: XrdOucCache.hh:158
std::map< int, Prefetch * > m_blocks
map of created blocks
Definition: XrdFileCacheIOFileBlock.hh:70
virtual bool ioActive()
Virtual method of XrdOucCacheIO. Called to check if destruction needs to be done in a separate task...
XrdSysMutex m_mutex
map mutex
Definition: XrdFileCacheIOFileBlock.hh:71
Definition: XrdSysError.hh:87
Downloads data into a file on local disk and handles IO read requests.
Definition: XrdFileCachePrefetch.hh:42
Definition: XrdSysPthread.hh:140
Base cache-io class that implements XrdOucCacheIO abstract methods.
Definition: XrdFileCache.hh:125
Prefetch * newBlockPrefetcher(long long off, int blocksize, XrdOucCacheIO *io)
long long m_blocksize
size of file-block
Definition: XrdFileCacheIOFileBlock.hh:69
IOFileBlock(XrdOucCacheIO &io, XrdOucCacheStats &stats, Cache &cache)
Constructor.
~IOFileBlock()
Destructor.
Definition: XrdFileCacheIOFileBlock.hh:50
Definition: XrdOss.hh:59
Definition: XrdOucCache.hh:93
virtual int Read(char *Buffer, long long Offset, int Length)
Pass Read request to the corresponding Prefetch object.
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdFileCache.hh:39