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 
13 #include <string.h>
14 #include <sys/types.h>
15 
16 #include "XrdFrc/XrdFrcXAttr.hh"
17 #include "XrdOss/XrdOssPath.hh"
18 #include "XrdOuc/XrdOucHash.hh"
19 #include "XrdOuc/XrdOucNSWalk.hh"
20 #include "XrdOuc/XrdOucXAttr.hh"
21 
22 class XrdOucTList;
23 
24 /******************************************************************************/
25 /* C l a s s X r d F r m F i l e s e t */
26 /******************************************************************************/
27 
29 {
30 public:
31 friend class XrdFrmFiles;
32 
33 // The following are the extended attributes describing file characteristics
34 //
37 
38 // These are inline function to return most common file information
39 //
41 const char *basePath() {return Mkfn(baseFile());}
43 const char *failPath() {return Mkfn(failFile());}
45 const char *lockPath() {return Mkfn(lockFile());}
47 const char * pfnPath() {return Mkfn(pfnFile());}
49 const char * pinPath() {return Mkfn(pinFile());}
50 
51 inline XrdOucNSWalk::NSEnt * xyzFile(XrdOssPath::theSfx sfx) {return File[sfx];}
52 const char * xyzPath(XrdOssPath::theSfx sfx)
53  {return Mkfn(File[sfx]);}
54 
55 int dirPath(char *dBuff, int dBlen);
56 
57 static void Purge() {BadFiles.Purge();}
58 
59 int Refresh(int isMig=0, int doLock=1);
60 
61 int Screen(int needLF=1);
62 
63 int setCpyTime(int Refresh=0);
64 
67 
68 // The following are public to ease management of this object
69 //
71 int Age;
72 
73 private:
74 int chkLock(const char *Path);
75 const char *Mkfn(XrdOucNSWalk::NSEnt *fP);
76 void Remfix(const char *fType, const char *fPath);
77 
78 // These are the basic set of files related to the base file. Two other file
79 // suffixes are ignore for fileset purposes (".anew" and ".stage").
80 //
82 
83 XrdOucTList *dInfo; // Shared directory information
84 
86 
87 static const int dLen = 0; // Index to directory path length in dInfo
88 static const int dRef = 1; // Index to the reference counter in dInfo
89 };
90 
91 /******************************************************************************/
92 /* C l a s s X r d F r m F i l e s */
93 /******************************************************************************/
94 
96 {
97 public:
98 
99 XrdFrmFileset *Get(int &rc, int noBase=0);
100 
101 static const int Recursive = 0x0001; // List filesets recursively
102 static const int CompressD = 0x0002; // Use shared directory object (not MT)
103 static const int NoAutoDel = 0x0004; // Do not automatically delete objects
104 static const int GetCpyTim = 0x0008; // Initialize cpyInfo attribute on Get()
105 
106  XrdFrmFiles(const char *dname, int opts=Recursive,
107  XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0);
108 
109  ~XrdFrmFiles();
110 
111 private:
112 void Complain(const char *dPath);
113 int oldFile(XrdOucNSWalk::NSEnt *fP, XrdOucTList *dP, int fType);
114 int Process(XrdOucNSWalk::NSEnt *nP, const char *dPath);
115 
117 
121 int shareD;
122 int getCPT;
123 };
124 #endif