xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
XrdPosixCacheBC.hh
Go to the documentation of this file.
1 #ifndef __XRDPOSIXCACHEBC_HH__
2 #define __XRDPOSIXCACHEBC_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d P o s i x C a c h e B C . h h */
6 /* */
7 /* (c) 2016 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include "XrdOuc/XrdOucCache2.hh"
34 
35 /******************************************************************************/
36 /* X r d P o s i x C a c h e B C I O */
37 /******************************************************************************/
38 
40 {
41 public:
42 
43 virtual
45 
46 virtual
48  cacheIO1->Detach();
49  delete this;
50  return theCIO;
51  }
52 
53 virtual
54 long long FSize() {return cacheIO1->FSize();}
55 
56 virtual int Fstat(struct stat &buf) {return cacheIO2->Fstat(buf);}
57 
58 virtual
59 const char *Location() {return cacheIO2->Location();}
60 
61 virtual
62 const char *Path() {return cacheIO1->Path();}
63 
65 
66 virtual int Read (char *Buffer, long long Offset, int Length)
67  {return cacheIO1->Read(Buffer, Offset, Length);}
68 
70 
71 virtual int ReadV(const XrdOucIOVec *readV, int n)
72  {return cacheIO1->ReadV(readV, n);}
73 
75 
76 virtual int Sync() {return cacheIO1->Sync();}
77 
79 
80 virtual int Trunc(long long Offset) {return cacheIO1->Trunc(Offset);}
81 
83 
84 virtual int Write(char *Buffer, long long Offset, int Length)
85  {return cacheIO1->Write(Buffer, Offset, Length);}
86 
87 virtual bool ioActive() { return cacheIO1->ioActive();}
88 
89 virtual void Preread (long long Offset, int Length, int Opts=0)
90  {return cacheIO1->Preread(Offset, Length, Opts);}
91 
92 virtual void Preread(aprParms &Parms) { cacheIO1->Preread(Parms);}
93 
95  : cacheIO1(urCIO), cacheIO2(myCIO) {}
96 virtual ~XrdPosixCacheBCIO() {}
97 
98 private:
101 };
102 
103 /******************************************************************************/
104 /* X r d P o s i x C a c h e B C */
105 /******************************************************************************/
106 
108 {
109 public:
111 
112 virtual
114  {XrdOucCacheIO *newIOP = v1Cache->Attach(ioP, opts);
115  if (newIOP == (XrdOucCacheIO *)ioP) return ioP;
116  return new XrdPosixCacheBCIO(newIOP, ioP);
117  }
118 
119 virtual int isAttached() {return v1Cache->isAttached();}
120 
121 virtual int Rmdir(const char* path) {return v1Cache->Rmdir(path);}
122 
123 virtual int Rename(const char* pathO, const char* pathN)
124  {return v1Cache->Rename(pathO, pathN);}
125 
126 virtual int Truncate(const char* path, off_t size)
127  {return v1Cache->Truncate(path, size);}
128 
129 virtual int Unlink(const char* path) {return v1Cache->Unlink(path);}
130 
132 virtual ~XrdPosixCacheBC() {}
133 private:
135 };
136 #endif
virtual int Unlink(const char *path)
Definition: XrdPosixCacheBC.hh:129
virtual XrdOucCacheIO * Attach(XrdOucCacheIO *ioP, int Options=0)=0
Definition: XrdPosixCacheBC.hh:39
virtual bool ioActive()
Definition: XrdPosixCacheBC.hh:87
virtual void Write(XrdOucCacheIOCB &iocb, char *buff, long long offs, int wlen)
Definition: XrdOucCache2.hh:174
XrdOucCache * v1Cache
Definition: XrdPosixCacheBC.hh:134
Definition: XrdOucCache2.hh:196
virtual int Truncate(const char *, off_t)
Definition: XrdOucCache.hh:382
XrdOucCacheIO2 * cacheIO2
Definition: XrdPosixCacheBC.hh:100
virtual const char * Path()
Definition: XrdPosixCacheBC.hh:62
virtual int Read(char *Buffer, long long Offset, int Length)
Definition: XrdPosixCacheBC.hh:66
Definition: XrdOucCache.hh:127
virtual int Read(char *Buffer, long long Offset, int Length)=0
virtual int Rmdir(const char *)
Definition: XrdOucCache.hh:374
virtual int Trunc(long long Offset)=0
virtual XrdOucCacheIO2 * Base()
Definition: XrdPosixCacheBC.hh:44
virtual int Rmdir(const char *path)
Definition: XrdPosixCacheBC.hh:121
virtual int Write(char *Buffer, long long Offset, int Length)=0
virtual int Fstat(struct stat &sbuff)
Definition: XrdOucCache2.hh:79
virtual ~XrdPosixCacheBCIO()
Definition: XrdPosixCacheBC.hh:96
virtual int Sync()
Definition: XrdPosixCacheBC.hh:76
virtual void ReadV(XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int rnum)
Definition: XrdOucCache2.hh:125
virtual ~XrdPosixCacheBC()
Definition: XrdPosixCacheBC.hh:132
virtual const char * Location()
Definition: XrdPosixCacheBC.hh:59
virtual long long FSize()
Definition: XrdPosixCacheBC.hh:54
Definition: XrdPosixCacheBC.hh:107
virtual XrdOucCacheIO2 * Attach(XrdOucCacheIO2 *ioP, int opts=0)=0
Definition: XrdOucCache.hh:282
virtual const char * Path()=0
virtual int Write(char *Buffer, long long Offset, int Length)
Definition: XrdPosixCacheBC.hh:84
virtual XrdOucCacheIO2 * Attach(XrdOucCacheIO2 *ioP, int opts=0)
Definition: XrdPosixCacheBC.hh:113
Definition: XrdOucCache2.hh:62
virtual int Fstat(struct stat &buf)
Definition: XrdPosixCacheBC.hh:56
virtual int Rename(const char *, const char *)
Definition: XrdOucCache.hh:378
virtual int ReadV(const XrdOucIOVec *readV, int n)
Definition: XrdOucCache.hh:160
Definition: XrdOucIOVec.hh:40
virtual int Trunc(long long Offset)
Definition: XrdPosixCacheBC.hh:80
virtual int Truncate(const char *path, off_t size)
Definition: XrdPosixCacheBC.hh:126
XrdPosixCacheBCIO(XrdOucCacheIO *urCIO, XrdOucCacheIO2 *myCIO)
Definition: XrdPosixCacheBC.hh:94
Definition: XrdOucCache.hh:247
XrdOucCacheIO * cacheIO1
Definition: XrdPosixCacheBC.hh:99
virtual bool ioActive()
Definition: XrdOucCache.hh:220
virtual void Read(XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
Definition: XrdOucCache2.hh:107
virtual int Unlink(const char *)
Definition: XrdOucCache.hh:370
virtual XrdOucCacheIO * Detach()
Definition: XrdOucCache.hh:214
#define stat(a, b)
Definition: XrdPosix.hh:96
virtual int isAttached()
Definition: XrdOucCache.hh:311
virtual int Sync()=0
virtual int Rename(const char *pathO, const char *pathN)
Definition: XrdPosixCacheBC.hh:123
XrdPosixCacheBC(XrdOucCache *cP)
Definition: XrdPosixCacheBC.hh:131
virtual void Preread(aprParms &Parms)
Definition: XrdPosixCacheBC.hh:92
virtual void Preread(long long Offset, int Length, int Opts=0)
Definition: XrdOucCache.hh:234
virtual long long FSize()=0
virtual const char * Location()
Definition: XrdOucCache2.hh:88
virtual void Preread(long long Offset, int Length, int Opts=0)
Definition: XrdPosixCacheBC.hh:89
virtual XrdOucCacheIO2 * Detach()
Definition: XrdPosixCacheBC.hh:47
virtual int isAttached()
Definition: XrdPosixCacheBC.hh:119
virtual int ReadV(const XrdOucIOVec *readV, int n)
Definition: XrdPosixCacheBC.hh:71