Skip to content

Commit

Permalink
Move base IO class to separate file.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent 19a7fb7 commit 923085a
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/XrdFileCache/XrdFileCacheIO.hh
@@ -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

0 comments on commit 923085a

Please sign in to comment.