XRootD
Loading...
Searching...
No Matches
XrdPosixCache.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* */
3/* X r d P o s i x C a c h e . c c */
4/* */
5/* (c) 2018 by the Board of Trustees of the Leland Stanford, Jr., University */
6/* All Rights Reserved */
7/* Produced by Andrew Hanushevsky for Stanford University under contract */
8/* DE-AC02-76-SFO0515 with the Department of Energy */
9/* */
10/* This file is part of the XRootD software suite. */
11/* */
12/* XRootD is free software: you can redistribute it and/or modify it under */
13/* the terms of the GNU Lesser General Public License as published by the */
14/* Free Software Foundation, either version 3 of the License, or (at your */
15/* option) any later version. */
16/* */
17/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
18/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
19/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
20/* License for more details. */
21/* */
22/* You should have received a copy of the GNU Lesser General Public License */
23/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
24/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
25/* */
26/* The copyright holder's institutional names and contributor's names may not */
27/* be used to endorse or promote products derived from this software without */
28/* specific prior written permission of the institution or contributor. */
29/******************************************************************************/
30
31#include "XrdOuc/XrdOucCache.hh"
34
35/******************************************************************************/
36/* G l o b a l s */
37/******************************************************************************/
38
40{
41extern XrdOucCache *theCache;
42}
43
44using namespace XrdPosixGlobals;
45
46/******************************************************************************/
47/* C a c h e P a t h */
48/******************************************************************************/
49
50int XrdPosixCache::CachePath(const char *url, char *buff, int blen)
51{
52 return theCache->LocalFilePath(url, buff, blen, XrdOucCache::ForPath);
53}
54
55/******************************************************************************/
56/* C a c h e Q u e r y */
57/******************************************************************************/
58
59int XrdPosixCache::CacheQuery(const char *url, bool hold)
60{
61
62 int rc = theCache->LocalFilePath(url, 0, 0,
65 );
66 if (!rc) return 1;
67 if (rc == -EREMOTE) return 0;
68 return -1;
69}
70
71/******************************************************************************/
72/* R m d i r */
73/******************************************************************************/
74
75int XrdPosixCache::Rmdir(const char* path)
76 {return theCache->Rmdir(path);}
77
78/******************************************************************************/
79/* R e n a m e */
80/******************************************************************************/
81
82int XrdPosixCache::Rename(const char* oldPath, const char* newPath)
83 {return theCache->Rename(oldPath, newPath);}
84
85/******************************************************************************/
86/* S t a t */
87/******************************************************************************/
88
89int XrdPosixCache::Stat(const char *path, struct stat &sbuff)
90 {return theCache->Stat(path, sbuff);}
91
92/******************************************************************************/
93/* S t a t i s t i c s */
94/******************************************************************************/
95
98
99/******************************************************************************/
100/* T r u n c a t e */
101/******************************************************************************/
102
103int XrdPosixCache::Truncate(const char* path, off_t size)
104 {return theCache->Truncate(path, size);}
105
106/******************************************************************************/
107/* U n l i n k */
108/******************************************************************************/
109
110int XrdPosixCache::Unlink(const char* path)
111 {return theCache->Unlink(path);}
#define stat(a, b)
Definition XrdPosix.hh:101
void Get(XrdOucCacheStats &D)
virtual int Rename(const char *oldp, const char *newp)
virtual int Stat(const char *url, struct stat &sbuff)
virtual int Truncate(const char *path, off_t size)
virtual int Unlink(const char *path)
virtual int LocalFilePath(const char *url, char *buff=0, int blen=0, LFP_Reason why=ForAccess, bool forall=false)
XrdOucCacheStats Statistics
virtual int Rmdir(const char *dirp)
int Unlink(const char *path)
int Rename(const char *oldPath, const char *newPath)
void Statistics(XrdOucCacheStats &Stats)
int Stat(const char *path, struct stat &sbuff)
int CachePath(const char *url, char *buff, int blen)
int Truncate(const char *path, off_t size)
int CacheQuery(const char *url, bool hold=false)
int Rmdir(const char *path)
XrdPosixStats Stats
XrdOucCache * theCache