XrdFrmFiles.hh

Go to the documentation of this file.
00001 #ifndef __FRMFILES__HH
00002 #define __FRMFILES__HH
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                        X r d F r m F i l e s . h h                         */
00006 /*                                                                            */
00007 /* (c) 2009 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012   
00013 //          $Id: XrdFrmFiles.hh 35287 2010-09-14 21:19:35Z ganis $
00014 
00015 #include <string.h>
00016 #include <sys/types.h>
00017 
00018 #include "XrdOss/XrdOssPath.hh"
00019 #include "XrdOuc/XrdOucHash.hh"
00020 #include "XrdOuc/XrdOucNSWalk.hh"
00021 
00022 class  XrdOucTList;
00023 
00024 /******************************************************************************/
00025 /*                   C l a s s   X r d F r m F i l e s e t                    */
00026 /******************************************************************************/
00027   
00028 class  XrdFrmFileset
00029 {
00030 public:
00031 friend class XrdFrmFiles;
00032 
00033 // These are inline function to return most common file information
00034 //
00035 inline XrdOucNSWalk::NSEnt *baseFile() {return File[XrdOssPath::isBase];}
00036 const  char                *basePath() {return Mkfn(baseFile());}
00037 inline XrdOucNSWalk::NSEnt *failFile() {return File[XrdOssPath::isFail];}
00038 const  char                *failPath() {return Mkfn(failFile());}
00039 inline XrdOucNSWalk::NSEnt *lockFile() {return File[XrdOssPath::isLock];}
00040 const  char                *lockPath() {return Mkfn(lockFile());}
00041 inline XrdOucNSWalk::NSEnt * pfnFile() {return File[XrdOssPath::isPfn ];}
00042 const  char                * pfnPath() {return Mkfn(pfnFile());}
00043 inline XrdOucNSWalk::NSEnt * pinFile() {return File[XrdOssPath::isPin ];}
00044 const  char                * pinPath() {return Mkfn(pinFile());}
00045 
00046 int                         dirPath(char *dBuff, int dBlen);
00047 
00048 int                         Refresh(int isMig=0, int doLock=1);
00049 
00050 void                        UnLock();
00051 
00052                      XrdFrmFileset(XrdFrmFileset *sP=0, XrdOucTList *diP=0);
00053                     ~XrdFrmFileset();
00054 
00055 // The following are public to ease management of this object
00056 //
00057 XrdFrmFileset *Next;
00058 int            Age;
00059 
00060 private:
00061 int         chkLock(const char *Path);
00062 int         getLock(char *Path, int Shared=0, int noWait=0);
00063 const char *Mkfn(XrdOucNSWalk::NSEnt *fP);
00064 
00065 // These are the basic set of files related to the base file. Two other file
00066 // suffixes are ignore for fileset purposes (".anew" and ".stage").
00067 //
00068 XrdOucNSWalk::NSEnt *File[XrdOssPath::sfxNum];
00069 
00070 XrdOucTList         *dInfo;     // Shared directory information
00071 static const int     dLen = 0;  // Index to directory path length in dInfo
00072 static const int     dRef = 1;  // Index to the reference counter in dInfo
00073 
00074 int                  dlkFD;     // Directory lock FD
00075 int                  flkFD;     // Lock file lock FD
00076 };
00077 
00078 /******************************************************************************/
00079 /*                     C l a s s   X r d F r m F i l e s                      */
00080 /******************************************************************************/
00081   
00082 class  XrdFrmFiles
00083 {
00084 public:
00085 
00086 XrdFrmFileset *Get(int &rc, int noBase=0);
00087 
00088 static const int Recursive = 0x0001;   // List filesets recursively
00089 static const int CompressD = 0x0002;   // Use shared directory object (not MT)
00090 static const int NoAutoDel = 0x0004;   // Do not automatically delete objects
00091 
00092             XrdFrmFiles(const char *dname, int opts=Recursive,
00093                         XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0);
00094 
00095            ~XrdFrmFiles() {}
00096 
00097 private:
00098 int  Process(XrdOucNSWalk::NSEnt *nP, const char *dPath);
00099 
00100 XrdOucHash<XrdFrmFileset>fsTab;
00101 
00102 XrdOucNSWalk             nsObj;
00103 XrdFrmFileset           *fsList;
00104 XrdOucHash_Options       manMem;
00105 int                      shareD;
00106 };
00107 #endif

Generated on Tue Jul 5 14:46:35 2011 for ROOT_528-00b_version by  doxygen 1.5.1