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