xrootd
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
34
35/******************************************************************************/
36/* X r d P o s i x C a c h e B C I O */
37/******************************************************************************/
38
40{
41public:
42
43virtual
45
46virtual
49 delete this;
50 return theCIO;
51 }
52
53virtual
54long long FSize() {return cacheIO1->FSize();}
55
56virtual int Fstat(struct stat &buf) {return cacheIO2->Fstat(buf);}
57
58virtual
59const char *Location() {return cacheIO2->Location();}
60
61virtual
62const char *Path() {return cacheIO1->Path();}
63
65
66virtual int Read (char *Buffer, long long Offset, int Length)
67 {return cacheIO1->Read(Buffer, Offset, Length);}
68
70
71virtual int ReadV(const XrdOucIOVec *readV, int n)
72 {return cacheIO1->ReadV(readV, n);}
73
75
76virtual int Sync() {return cacheIO1->Sync();}
77
79
80virtual int Trunc(long long Offset) {return cacheIO1->Trunc(Offset);}
81
83
84virtual int Write(char *Buffer, long long Offset, int Length)
85 {return cacheIO1->Write(Buffer, Offset, Length);}
86
87virtual bool ioActive() { return cacheIO1->ioActive();}
88
89virtual void Preread (long long Offset, int Length, int Opts=0)
90 {return cacheIO1->Preread(Offset, Length, Opts);}
91
92virtual void Preread(aprParms &Parms) { cacheIO1->Preread(Parms);}
93
95 : cacheIO1(urCIO), cacheIO2(myCIO) {}
97
98private:
101};
102
103/******************************************************************************/
104/* X r d P o s i x C a c h e B C */
105/******************************************************************************/
106
108{
109public:
111
112virtual
114 {XrdOucCacheIO *newIOP = v1Cache->Attach(ioP, opts);
115 if (newIOP == (XrdOucCacheIO *)ioP) return ioP;
116 return new XrdPosixCacheBCIO(newIOP, ioP);
117 }
118
119virtual int isAttached() {return v1Cache->isAttached();}
120
121virtual int Rmdir(const char* path) {return v1Cache->Rmdir(path);}
122
123virtual int Rename(const char* pathO, const char* pathN)
124 {return v1Cache->Rename(pathO, pathN);}
125
126virtual int Truncate(const char* path, off_t size)
127 {return v1Cache->Truncate(path, size);}
128
129virtual int Unlink(const char* path) {return v1Cache->Unlink(path);}
130
133private:
135};
136#endif
#define stat(a, b)
Definition: XrdPosix.hh:96
Definition: XrdOucCache2.hh:197
virtual XrdOucCacheIO2 * Attach(XrdOucCacheIO2 *ioP, int opts=0)=0
Definition: XrdOucCache2.hh:63
virtual void Read(XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
Definition: XrdOucCache2.hh:107
virtual int Sync()=0
virtual const char * Location()
Definition: XrdOucCache2.hh:88
virtual void Write(XrdOucCacheIOCB &iocb, char *buff, long long offs, int wlen)
Definition: XrdOucCache2.hh:174
virtual int Fstat(struct stat &sbuff)
Definition: XrdOucCache2.hh:79
virtual void ReadV(XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int rnum)
Definition: XrdOucCache2.hh:125
Definition: XrdOucCache.hh:128
virtual int Sync()=0
virtual XrdOucCacheIO * Detach()
Definition: XrdOucCache.hh:214
virtual long long FSize()=0
virtual const char * Path()=0
virtual int Read(char *Buffer, long long Offset, int Length)=0
virtual void Preread(long long Offset, int Length, int Opts=0)
Definition: XrdOucCache.hh:234
virtual int Write(char *Buffer, long long Offset, int Length)=0
virtual int ReadV(const XrdOucIOVec *readV, int n)
Definition: XrdOucCache.hh:160
virtual int Trunc(long long Offset)=0
virtual bool ioActive()
Definition: XrdOucCache.hh:220
Definition: XrdOucCache.hh:283
virtual int Unlink(const char *)
Definition: XrdOucCache.hh:370
virtual XrdOucCacheIO * Attach(XrdOucCacheIO *ioP, int Options=0)=0
virtual int isAttached()
Definition: XrdOucCache.hh:311
virtual int Truncate(const char *, off_t)
Definition: XrdOucCache.hh:382
virtual int Rename(const char *, const char *)
Definition: XrdOucCache.hh:378
virtual int Rmdir(const char *)
Definition: XrdOucCache.hh:374
Definition: XrdPosixCacheBC.hh:40
virtual XrdOucCacheIO2 * Base()
Definition: XrdPosixCacheBC.hh:44
virtual int Sync()
Definition: XrdPosixCacheBC.hh:76
virtual const char * Path()
Definition: XrdPosixCacheBC.hh:62
virtual XrdOucCacheIO2 * Detach()
Definition: XrdPosixCacheBC.hh:47
XrdPosixCacheBCIO(XrdOucCacheIO *urCIO, XrdOucCacheIO2 *myCIO)
Definition: XrdPosixCacheBC.hh:94
virtual const char * Location()
Definition: XrdPosixCacheBC.hh:59
virtual int Trunc(long long Offset)
Definition: XrdPosixCacheBC.hh:80
virtual int ReadV(const XrdOucIOVec *readV, int n)
Definition: XrdPosixCacheBC.hh:71
virtual int Read(char *Buffer, long long Offset, int Length)
Definition: XrdPosixCacheBC.hh:66
XrdOucCacheIO2 * cacheIO2
Definition: XrdPosixCacheBC.hh:100
XrdOucCacheIO * cacheIO1
Definition: XrdPosixCacheBC.hh:99
virtual long long FSize()
Definition: XrdPosixCacheBC.hh:54
virtual int Fstat(struct stat &buf)
Definition: XrdPosixCacheBC.hh:56
virtual void Preread(long long Offset, int Length, int Opts=0)
Definition: XrdPosixCacheBC.hh:89
virtual void Preread(aprParms &Parms)
Definition: XrdPosixCacheBC.hh:92
virtual bool ioActive()
Definition: XrdPosixCacheBC.hh:87
virtual ~XrdPosixCacheBCIO()
Definition: XrdPosixCacheBC.hh:96
virtual int Write(char *Buffer, long long Offset, int Length)
Definition: XrdPosixCacheBC.hh:84
Definition: XrdPosixCacheBC.hh:108
virtual XrdOucCacheIO2 * Attach(XrdOucCacheIO2 *ioP, int opts=0)
Definition: XrdPosixCacheBC.hh:113
virtual int isAttached()
Definition: XrdPosixCacheBC.hh:119
virtual int Rename(const char *pathO, const char *pathN)
Definition: XrdPosixCacheBC.hh:123
virtual int Truncate(const char *path, off_t size)
Definition: XrdPosixCacheBC.hh:126
XrdPosixCacheBC(XrdOucCache *cP)
Definition: XrdPosixCacheBC.hh:131
virtual int Rmdir(const char *path)
Definition: XrdPosixCacheBC.hh:121
virtual ~XrdPosixCacheBC()
Definition: XrdPosixCacheBC.hh:132
XrdOucCache * v1Cache
Definition: XrdPosixCacheBC.hh:134
virtual int Unlink(const char *path)
Definition: XrdPosixCacheBC.hh:129
Definition: XrdOucCache.hh:248
Definition: XrdOucIOVec.hh:41