00001 #ifndef __FRMFILES__HH
00002 #define __FRMFILES__HH
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <string.h>
00034 #include <sys/types.h>
00035
00036 #include "XrdFrc/XrdFrcXAttr.hh"
00037 #include "XrdOss/XrdOssPath.hh"
00038 #include "XrdOuc/XrdOucHash.hh"
00039 #include "XrdOuc/XrdOucNSWalk.hh"
00040 #include "XrdOuc/XrdOucXAttr.hh"
00041
00042 class XrdOucTList;
00043
00044
00045
00046
00047
00048 class XrdFrmFileset
00049 {
00050 public:
00051 friend class XrdFrmFiles;
00052
00053
00054
00055 XrdOucXAttr<XrdFrcXAttrCpy> cpyInfo;
00056 XrdOucXAttr<XrdFrcXAttrPin> pinInfo;
00057
00058
00059
00060 inline XrdOucNSWalk::NSEnt *baseFile() {return File[XrdOssPath::isBase];}
00061 const char *basePath() {return Mkfn(baseFile());}
00062 inline XrdOucNSWalk::NSEnt *failFile() {return File[XrdOssPath::isFail];}
00063 const char *failPath() {return Mkfn(failFile());}
00064 inline XrdOucNSWalk::NSEnt *lockFile() {return File[XrdOssPath::isLock];}
00065 const char *lockPath() {return Mkfn(lockFile());}
00066 inline XrdOucNSWalk::NSEnt * pfnFile() {return File[XrdOssPath::isPfn ];}
00067 const char * pfnPath() {return Mkfn(pfnFile());}
00068 inline XrdOucNSWalk::NSEnt * pinFile() {return File[XrdOssPath::isPin ];}
00069 const char * pinPath() {return Mkfn(pinFile());}
00070
00071 inline XrdOucNSWalk::NSEnt * xyzFile(XrdOssPath::theSfx sfx) {return File[sfx];}
00072 const char * xyzPath(XrdOssPath::theSfx sfx)
00073 {return Mkfn(File[sfx]);}
00074
00075 int dirPath(char *dBuff, int dBlen);
00076
00077 static void Purge() {BadFiles.Purge();}
00078
00079 int Refresh(int isMig=0, int doLock=1);
00080
00081 int Screen(int needLF=1);
00082
00083 int setCpyTime(int Refresh=0);
00084
00085 XrdFrmFileset(XrdFrmFileset *sP=0, XrdOucTList *diP=0);
00086 ~XrdFrmFileset();
00087
00088
00089
00090 XrdFrmFileset *Next;
00091 int Age;
00092
00093 private:
00094 int chkLock(const char *Path);
00095 const char *Mkfn(XrdOucNSWalk::NSEnt *fP);
00096 void Remfix(const char *fType, const char *fPath);
00097
00098
00099
00100
00101 XrdOucNSWalk::NSEnt *File[XrdOssPath::sfxNum];
00102
00103 XrdOucTList *dInfo;
00104
00105 static XrdOucHash<char> BadFiles;
00106
00107 static const int dLen = 0;
00108 static const int dRef = 1;
00109 };
00110
00111
00112
00113
00114
00115 class XrdFrmFiles
00116 {
00117 public:
00118
00119 XrdFrmFileset *Get(int &rc, int noBase=0);
00120
00121 static const int Recursive = 0x0001;
00122 static const int CompressD = 0x0002;
00123 static const int NoAutoDel = 0x0004;
00124 static const int GetCpyTim = 0x0008;
00125
00126 XrdFrmFiles(const char *dname, int opts=Recursive,
00127 XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0);
00128
00129 ~XrdFrmFiles();
00130
00131 private:
00132 void Complain(const char *dPath);
00133 int oldFile(XrdOucNSWalk::NSEnt *fP, XrdOucTList *dP, int fType);
00134 int Process(XrdOucNSWalk::NSEnt *nP, const char *dPath);
00135
00136 XrdOucHash<XrdFrmFileset>fsTab;
00137
00138 XrdOucNSWalk nsObj;
00139 XrdFrmFileset *fsList;
00140 XrdOucHash_Options manMem;
00141 int shareD;
00142 int getCPT;
00143 };
00144 #endif