xrootd
XrdOucCache2.hh
Go to the documentation of this file.
1#ifndef __XRDOUCCACHE2_HH__
2#define __XRDOUCCACHE2_HH__
3/******************************************************************************/
4/* */
5/* X r d O u c C a c h e 2 . 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 <errno.h>
34
35#include "XrdOuc/XrdOucCache.hh"
36
37//-----------------------------------------------------------------------------
50//-----------------------------------------------------------------------------
51
52/******************************************************************************/
53/* C l a s s X r d O u c C a c h e I O 2 */
54/******************************************************************************/
55
56//------------------------------------------------------------------------------
60//------------------------------------------------------------------------------
61
62class XrdOucCacheIO2 : public virtual XrdOucCacheIO
63{
64public:
65
66//------------------------------------------------------------------------------
77//------------------------------------------------------------------------------
78
79virtual int Fstat(struct stat &sbuff) {(void)sbuff; return 1;}
80
81//-----------------------------------------------------------------------------
86//-----------------------------------------------------------------------------
87virtual
88const char *Location() {return "";}
89
90//------------------------------------------------------------------------------
103//------------------------------------------------------------------------------
104
106
107virtual void Read (XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
108 {iocb.Done(Read(buff, offs, rlen));}
109
110//------------------------------------------------------------------------------
121//------------------------------------------------------------------------------
122
124
125virtual void ReadV(XrdOucCacheIOCB &iocb, const XrdOucIOVec *readV, int rnum)
126 {iocb.Done(ReadV(readV, rnum));}
127
128//------------------------------------------------------------------------------
137//------------------------------------------------------------------------------
138
140
141virtual void Sync(XrdOucCacheIOCB &iocb) {iocb.Done(Sync());}
142
143//------------------------------------------------------------------------------
153//------------------------------------------------------------------------------
154
155virtual void Update(XrdOucCacheIO2 &iocp) {}
156
157//------------------------------------------------------------------------------
170//------------------------------------------------------------------------------
171
173
174virtual void Write(XrdOucCacheIOCB &iocb, char *buff, long long offs, int wlen)
175 {iocb.Done(Write(buff, offs, wlen));}
176
177//------------------------------------------------------------------------------
178
179virtual ~XrdOucCacheIO2() {} // Always use Detach() instead of direct delete!
180};
181
182/******************************************************************************/
183/* C l a s s X r d O u c C a c h e 2 */
184/******************************************************************************/
185
186class XrdOucEnv;
187struct stat;
188
189//------------------------------------------------------------------------------
194//------------------------------------------------------------------------------
195
196class XrdOucCache2 : public virtual XrdOucCache
197{
198public:
199
200//------------------------------------------------------------------------------
214//------------------------------------------------------------------------------
215
217
218virtual
219XrdOucCacheIO2 *Attach(XrdOucCacheIO2 *ioP, int opts=0) = 0;
220
221virtual
223 {errno = ENOSYS; return ioP;}
224
225//------------------------------------------------------------------------------
231//------------------------------------------------------------------------------
232virtual
234 {return this;}
235
236//------------------------------------------------------------------------------
247//------------------------------------------------------------------------------
248virtual
249void EnvInfo(XrdOucEnv &theEnv) {(void)theEnv;}
250
251//------------------------------------------------------------------------------
295//------------------------------------------------------------------------------
296
298
299virtual
300int LocalFilePath(const char *url, char *buff=0, int blen=0,
301 LFP_Reason why=ForAccess, bool forall=false)
302 {(void)url; (void)buff; (void)blen; (void)why;
303 if (buff && blen > 0) *buff = 0;
304 return -ENOTSUP;
305 }
306
307//------------------------------------------------------------------------------
323//------------------------------------------------------------------------------
324virtual
325int Prepare(const char *url, int oflags, mode_t mode)
326 {(void)url; (void)oflags; (void)mode; return 0;}
327
328//------------------------------------------------------------------------------
340//------------------------------------------------------------------------------
341
342virtual int Stat(const char *url, struct stat &sbuff)
343 {(void)url; (void)sbuff; return 1;}
344
346virtual ~XrdOucCache2() {}
347};
348
349/******************************************************************************/
350/* C r e a t i n g C a c h e P l u g - I n s */
351/******************************************************************************/
352
353//------------------------------------------------------------------------------
382#endif
#define stat(a, b)
Definition: XrdPosix.hh:96
Definition: XrdOucCache2.hh:197
virtual void EnvInfo(XrdOucEnv &theEnv)
Definition: XrdOucCache2.hh:249
virtual ~XrdOucCache2()
Definition: XrdOucCache2.hh:346
virtual XrdOucCacheIO * Attach(XrdOucCacheIO *ioP, int opts=0)
Definition: XrdOucCache2.hh:222
virtual XrdOucCacheIO2 * Attach(XrdOucCacheIO2 *ioP, int opts=0)=0
LFP_Reason
Definition: XrdOucCache2.hh:297
@ ForAccess
Definition: XrdOucCache2.hh:297
@ ForPath
Definition: XrdOucCache2.hh:297
@ ForInfo
Definition: XrdOucCache2.hh:297
virtual int Stat(const char *url, struct stat &sbuff)
Definition: XrdOucCache2.hh:342
virtual int LocalFilePath(const char *url, char *buff=0, int blen=0, LFP_Reason why=ForAccess, bool forall=false)
Definition: XrdOucCache2.hh:300
XrdOucCache2()
Definition: XrdOucCache2.hh:345
virtual XrdOucCache * Create(Parms &Params, XrdOucCacheIO::aprParms *aprP=0)
Definition: XrdOucCache2.hh:233
virtual int Prepare(const char *url, int oflags, mode_t mode)
Definition: XrdOucCache2.hh:325
Definition: XrdOucCache2.hh:63
virtual void Read(XrdOucCacheIOCB &iocb, char *buff, long long offs, int rlen)
Definition: XrdOucCache2.hh:107
virtual void Sync(XrdOucCacheIOCB &iocb)
Definition: XrdOucCache2.hh:141
virtual void Update(XrdOucCacheIO2 &iocp)
Definition: XrdOucCache2.hh:155
virtual const char * Location()
Definition: XrdOucCache2.hh:88
virtual ~XrdOucCacheIO2()
Definition: XrdOucCache2.hh:179
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:94
virtual void Done(int result)=0
Definition: XrdOucCache.hh:128
virtual int Sync()=0
virtual int Read(char *Buffer, long long Offset, int Length)=0
virtual int Write(char *Buffer, long long Offset, int Length)=0
virtual int ReadV(const XrdOucIOVec *readV, int n)
Definition: XrdOucCache.hh:160
Definition: XrdOucCache.hh:283
virtual XrdOucCacheIO * Attach(XrdOucCacheIO *ioP, int Options=0)=0
Definition: XrdOucEnv.hh:42
Definition: XrdOucCache.hh:248
Definition: XrdOucCache.hh:321
Definition: XrdOucIOVec.hh:41