xrootd
XrdFrmFiles.hh
Go to the documentation of this file.
1 #ifndef __FRMFILES__HH
2 #define __FRMFILES__HH
3 /******************************************************************************/
4 /* */
5 /* X r d F r m F i l e s . h h */
6 /* */
7 /* (c) 2009 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 <string.h>
34 #include <sys/types.h>
35 
36 #include "XrdFrc/XrdFrcXAttr.hh"
37 #include "XrdOss/XrdOssPath.hh"
38 #include "XrdOuc/XrdOucHash.hh"
39 #include "XrdOuc/XrdOucNSWalk.hh"
40 #include "XrdOuc/XrdOucXAttr.hh"
41 
42 class XrdOucTList;
43 
44 /******************************************************************************/
45 /* C l a s s X r d F r m F i l e s e t */
46 /******************************************************************************/
47 
49 {
50 public:
51 friend class XrdFrmFiles;
52 
53 // The following are the extended attributes describing file characteristics
54 //
57 
58 // These are inline function to return most common file information
59 //
61 const char *basePath() {return Mkfn(baseFile());}
63 const char *failPath() {return Mkfn(failFile());}
65 const char *lockPath() {return Mkfn(lockFile());}
67 const char * pfnPath() {return Mkfn(pfnFile());}
69 const char * pinPath() {return Mkfn(pinFile());}
70 
71 inline XrdOucNSWalk::NSEnt * xyzFile(XrdOssPath::theSfx sfx) {return File[sfx];}
72 const char * xyzPath(XrdOssPath::theSfx sfx)
73  {return Mkfn(File[sfx]);}
74 
75 int dirPath(char *dBuff, int dBlen);
76 
77 static void Purge() {BadFiles.Purge();}
78 
79 int Refresh(int isMig=0, int doLock=1);
80 
81 int Screen(int needLF=1);
82 
83 int setCpyTime(int Refresh=0);
84 
87 
88 // The following are public to ease management of this object
89 //
91 int Age;
92 
93 private:
94 int chkLock(const char *Path);
95 const char *Mkfn(XrdOucNSWalk::NSEnt *fP);
96 void Remfix(const char *fType, const char *fPath);
97 
98 // These are the basic set of files related to the base file. Two other file
99 // suffixes are ignore for fileset purposes (".anew" and ".stage").
100 //
102 
103 XrdOucTList *dInfo; // Shared directory information
104 
106 
107 static const int dLen = 0; // Index to directory path length in dInfo
108 static const int dRef = 1; // Index to the reference counter in dInfo
109 };
110 
111 /******************************************************************************/
112 /* C l a s s X r d F r m F i l e s */
113 /******************************************************************************/
114 
116 {
117 public:
118 
119 XrdFrmFileset *Get(int &rc, int noBase=0);
120 
121 static const int Recursive = 0x0001; // List filesets recursively
122 static const int CompressD = 0x0002; // Use shared directory object (not MT)
123 static const int NoAutoDel = 0x0004; // Do not automatically delete objects
124 static const int GetCpyTim = 0x0008; // Initialize cpyInfo attribute on Get()
125 
126  XrdFrmFiles(const char *dname, int opts=Recursive,
127  XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0);
128 
129  ~XrdFrmFiles();
130 
131 private:
132 void Complain(const char *dPath);
133 int oldFile(XrdOucNSWalk::NSEnt *fP, XrdOucTList *dP, int fType);
134 int Process(XrdOucNSWalk::NSEnt *nP, const char *dPath);
135 
137 
141 int shareD;
142 int getCPT;
143 };
144 #endif
XrdOucHash_Options manMem
Definition: XrdFrmFiles.hh:140
Definition: XrdOucNSWalk.hh:87
const char * xyzPath(XrdOssPath::theSfx sfx)
Definition: XrdFrmFiles.hh:72
XrdOucTList * dInfo
Definition: XrdFrmFiles.hh:103
XrdOucXAttr< XrdFrcXAttrPin > pinInfo
Definition: XrdFrmFiles.hh:56
static const int dLen
Definition: XrdFrmFiles.hh:107
Definition: XrdFrmFiles.hh:115
XrdOucHash< XrdFrmFileset > fsTab
Definition: XrdFrmFiles.hh:136
static const int CompressD
Definition: XrdFrmFiles.hh:122
XrdFrmFileset * fsList
Definition: XrdFrmFiles.hh:139
XrdOucNSWalk::NSEnt * lockFile()
Definition: XrdFrmFiles.hh:64
const char * failPath()
Definition: XrdFrmFiles.hh:63
XrdFrmFiles(const char *dname, int opts=Recursive, XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0)
const char * basePath()
Definition: XrdFrmFiles.hh:61
int Screen(int needLF=1)
int shareD
Definition: XrdFrmFiles.hh:141
Definition: XrdOssPath.hh:71
int dirPath(char *dBuff, int dBlen)
Definition: XrdOssPath.hh:69
XrdOucNSWalk::NSEnt * pinFile()
Definition: XrdFrmFiles.hh:68
const char * lockPath()
Definition: XrdFrmFiles.hh:65
XrdOucNSWalk::NSEnt * pfnFile()
Definition: XrdFrmFiles.hh:66
const char * pinPath()
Definition: XrdFrmFiles.hh:69
Definition: XrdOssPath.hh:68
static const int Recursive
Definition: XrdFrmFiles.hh:121
XrdFrmFileset(XrdFrmFileset *sP=0, XrdOucTList *diP=0)
XrdOucNSWalk::NSEnt * baseFile()
Definition: XrdFrmFiles.hh:60
int chkLock(const char *Path)
XrdOucNSWalk::NSEnt * xyzFile(XrdOssPath::theSfx sfx)
Definition: XrdFrmFiles.hh:71
XrdOucHash_Options
Definition: XrdOucHash.hh:51
void Complain(const char *dPath)
int setCpyTime(int Refresh=0)
void Purge()
static XrdOucHash< char > BadFiles
Definition: XrdFrmFiles.hh:105
int oldFile(XrdOucNSWalk::NSEnt *fP, XrdOucTList *dP, int fType)
Definition: XrdOucTList.hh:41
static const int NoAutoDel
Definition: XrdFrmFiles.hh:123
theSfx
Definition: XrdOssPath.hh:68
static const int GetCpyTim
Definition: XrdFrmFiles.hh:124
const char * Mkfn(XrdOucNSWalk::NSEnt *fP)
const char * pfnPath()
Definition: XrdFrmFiles.hh:67
Definition: XrdOssPath.hh:69
void Remfix(const char *fType, const char *fPath)
XrdOucNSWalk::NSEnt * failFile()
Definition: XrdFrmFiles.hh:62
XrdOucNSWalk::NSEnt * File[XrdOssPath::sfxNum]
Definition: XrdFrmFiles.hh:101
static const int dRef
Definition: XrdFrmFiles.hh:108
XrdOucXAttr< XrdFrcXAttrCpy > cpyInfo
Definition: XrdFrmFiles.hh:55
XrdFrmFileset * Next
Definition: XrdFrmFiles.hh:90
static void Purge()
Definition: XrdFrmFiles.hh:77
Definition: XrdOssPath.hh:69
XrdFrmFileset * Get(int &rc, int noBase=0)
int getCPT
Definition: XrdFrmFiles.hh:142
Definition: XrdOucNSWalk.hh:46
XrdOucNSWalk nsObj
Definition: XrdFrmFiles.hh:138
int Age
Definition: XrdFrmFiles.hh:91
Definition: XrdOssPath.hh:71
int Process(XrdOucNSWalk::NSEnt *nP, const char *dPath)
Definition: XrdFrmFiles.hh:48
Definition: XrdOucNSWalk.hh:42
int Refresh(int isMig=0, int doLock=1)