Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move base IO class to separate file.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#ifndef __XRDFILECACHE_CACHE_IO_HH__ | ||
#define __XRDFILECACHE_CACHE_IO_HH__ | ||
|
||
#include "XrdFileCache.hh" | ||
#include "XrdOuc/XrdOucCache.hh" | ||
#include "XrdCl/XrdClDefaultEnv.hh" | ||
|
||
namespace XrdFileCache | ||
{ | ||
//---------------------------------------------------------------------------- | ||
//! Base cache-io class that implements XrdOucCacheIO abstract methods. | ||
//---------------------------------------------------------------------------- | ||
class IO : public XrdOucCacheIO | ||
{ | ||
public: | ||
IO (XrdOucCacheIO &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; } | ||
|
||
|
||
protected: | ||
XrdCl::Log* clLog() const { return XrdCl::DefaultEnv::GetLog(); } | ||
|
||
XrdOucCacheIO &m_io; //!< original data source | ||
XrdOucCacheStats &m_statsGlobal; //!< reference to Cache statistics | ||
Cache &m_cache; //!< reference to Cache needed in detach | ||
}; | ||
} | ||
|
||
#endif |