-
Notifications
You must be signed in to change notification settings - Fork 149
/
XrdFileCacheIO.hh
48 lines (35 loc) · 1.57 KB
/
XrdFileCacheIO.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef __XRDFILECACHE_CACHE_IO_HH__
#define __XRDFILECACHE_CACHE_IO_HH__
#include "XrdFileCache.hh"
#include "XrdOuc/XrdOucCache2.hh"
#include "XrdCl/XrdClDefaultEnv.hh"
namespace XrdFileCache
{
//----------------------------------------------------------------------------
//! Base cache-io class that implements XrdOucCacheIO abstract methods.
//----------------------------------------------------------------------------
class IO : public XrdOucCacheIO2
{
public:
IO (XrdOucCacheIO2 *io, XrdOucCacheStats &stats, Cache &cache) :
m_io(io), m_statsGlobal(stats), m_cache(cache) {}
//! Original data source.
virtual XrdOucCacheIO *Base() { return m_io; }
//! Original data source URL.
virtual long long FSize() { return m_io->FSize(); }
//! Original data source URL.
virtual const char *Path() { return m_io->Path(); }
virtual int Sync() { return 0; }
virtual int Trunc(long long Offset) { errno = ENOTSUP; return -1; }
virtual int Write(char *Buffer, long long Offset, int Length)
{ errno = ENOTSUP; return -1; }
virtual void Update(XrdOucCacheIO2 &iocp) { m_io = &iocp; }
virtual void RelinquishFile(File*) {}
protected:
XrdCl::Log* clLog() const { return XrdCl::DefaultEnv::GetLog(); }
XrdOucCacheIO2 *m_io; //!< original data source
XrdOucCacheStats &m_statsGlobal; //!< reference to Cache statistics
Cache &m_cache; //!< reference to Cache needed in detach
};
}
#endif