00001 #ifndef __XRDPFC_CACHE_IO_HH__ 00002 #define __XRDPFC_CACHE_IO_HH__ 00003 00004 class XrdSysTrace; 00005 00006 #include "XrdPfc.hh" 00007 #include "XrdOuc/XrdOucCache.hh" 00008 #include "XrdCl/XrdClDefaultEnv.hh" 00009 #include "XrdSys/XrdSysPthread.hh" 00010 00011 namespace XrdPfc 00012 { 00013 //---------------------------------------------------------------------------- 00015 //---------------------------------------------------------------------------- 00016 class IO : public XrdOucCacheIO 00017 { 00018 public: 00019 IO (XrdOucCacheIO *io, XrdOucCacheStats &stats, Cache &cache); 00020 00022 virtual XrdOucCacheIO *Base() { return m_io; } 00023 00025 virtual const char *Path() { return m_io->Path(); } 00026 00027 using XrdOucCacheIO::Sync; 00028 00029 virtual int Sync() { return 0; } 00030 00031 using XrdOucCacheIO::Trunc; 00032 00033 virtual int Trunc(long long Offset) { return -ENOTSUP; } 00034 00035 using XrdOucCacheIO::Write; 00036 00037 virtual int Write(char *Buffer, long long Offset, int Length) { return -ENOTSUP; } 00038 00039 virtual void Update(XrdOucCacheIO &iocp); 00040 00041 // Detach is virtual from XrdOucCacheIO, here it is split 00042 // into abstract ioActive() and DetachFinalize(). 00043 bool Detach(XrdOucCacheIOCD &iocdP) /* final */; 00044 00045 virtual bool ioActive() = 0; 00046 virtual void DetachFinalize() = 0; 00047 00048 XrdSysTrace* GetTrace() { return m_cache.GetTrace(); } 00049 00050 XrdOucCacheIO* GetInput(); 00051 00052 protected: 00053 XrdOucCacheStats &m_statsGlobal; 00054 Cache &m_cache; 00055 00056 const char *m_traceID; 00057 std::string m_path; 00058 const char* GetPath() { return m_path.c_str(); } 00059 00060 private: 00061 XrdOucCacheIO *m_io; 00062 XrdSysMutex updMutex; 00063 void SetInput(XrdOucCacheIO*); 00064 }; 00065 } 00066 00067 #endif 00068