xrootd
XrdFileCacheIOEntireFile.hh
Go to the documentation of this file.
1#ifndef __XRDFILECACHE_IO_ENTIRE_FILE_HH__
2#define __XRDFILECACHE_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
24#include "XrdFileCacheIO.hh"
25#include "XrdFileCache.hh"
26#include "XrdFileCacheStats.hh"
27#include "XrdFileCacheFile.hh"
28
29class XrdSysError;
30class XrdOssDF;
31class XfcStats;
32class XrdOucIOVec;
33
34namespace XrdFileCache
35{
36//----------------------------------------------------------------------------
39//----------------------------------------------------------------------------
40class IOEntireFile : public IO
41{
42public:
43 //------------------------------------------------------------------------
45 //------------------------------------------------------------------------
47
48 //------------------------------------------------------------------------
50 //------------------------------------------------------------------------
52
53 //------------------------------------------------------------------------
55 //------------------------------------------------------------------------
56 bool HasFile() const { return m_file != 0; }
57
58 //---------------------------------------------------------------------
66 //---------------------------------------------------------------------
68
69 virtual int Read(char *Buffer, long long Offset, int Length);
70
71 //---------------------------------------------------------------------
78 //---------------------------------------------------------------------
80
81 virtual int ReadV(const XrdOucIOVec *readV, int n);
82
83 //---------------------------------------------------------------------
87 //---------------------------------------------------------------------
89
92 virtual bool ioActive();
93
94 virtual int Fstat(struct stat &sbuff);
95
96 virtual long long FSize();
97
98private:
102 int initCachedStat(const char* path);
103};
104
105}
106#endif
107
#define stat(a, b)
Definition: XrdPosix.hh:96
Attaches/creates and detaches/deletes cache-io objects for disk based cache.
Definition: XrdFileCache.hh:130
Definition: XrdFileCacheFile.hh:134
Downloads original file into a single file on local disk. Handles read requests as they come along.
Definition: XrdFileCacheIOEntireFile.hh:41
XrdSysMutex m_mutex
Definition: XrdFileCacheIOEntireFile.hh:99
IOEntireFile(XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &cache)
Constructor.
File * m_file
Definition: XrdFileCacheIOEntireFile.hh:100
virtual int Read(char *Buffer, long long Offset, int Length)
int initCachedStat(const char *path)
virtual bool ioActive()
Virtual method of XrdOucCacheIO. Called to check if destruction needs to be done in a separate task.
struct stat * m_localStat
Definition: XrdFileCacheIOEntireFile.hh:101
virtual long long FSize()
virtual XrdOucCacheIO * Detach()
virtual int Fstat(struct stat &sbuff)
virtual int ReadV(const XrdOucIOVec *readV, int n)
bool HasFile() const
Check if File was opened successfully.
Definition: XrdFileCacheIOEntireFile.hh:56
Base cache-io class that implements XrdOucCacheIO abstract methods.
Definition: XrdFileCacheIO.hh:17
Definition: XrdOss.hh:60
Definition: XrdOucCache2.hh:63
virtual void Read(XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
Definition: XrdOucCache2.hh:107
virtual void ReadV(XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int rnum)
Definition: XrdOucCache2.hh:125
Definition: XrdOucCache.hh:128
Definition: XrdOucCacheStats.hh:41
Definition: XrdSysError.hh:90
Definition: XrdSysPthread.hh:166
Definition: XrdFileCache.hh:40
Definition: XrdOucIOVec.hh:41