• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

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,v 1.3 2009/12/18 22:39:50 abh Exp $
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                                   : Next(sP), dInfo(diP),
00054                                     dlkFD(-1), flkFD(-1)
00055                                    {memset(File, 0, sizeof(File));}
00056                     ~XrdFrmFileset();
00057 
00058 // The following are public to ease management of this object
00059 //
00060 XrdFrmFileset *Next;
00061 int            Age;
00062 
00063 private:
00064 int         chkLock(const char *Path);
00065 int         getLock(char *Path, int Shared=0, int noWait=0);
00066 const char *Mkfn(XrdOucNSWalk::NSEnt *fP);
00067 
00068 // These are the basic set of files related to the base file. Two other file
00069 // suffixes are ignore for fileset purposes (".anew" and ".stage").
00070 //
00071 XrdOucNSWalk::NSEnt *File[XrdOssPath::sfxNum];
00072 
00073 XrdOucTList         *dInfo;     // Shared directory information
00074 static const int     dLen = 0;  // Index to directory path length in dInfo
00075 static const int     dRef = 1;  // Index to the reference counter in dInfo
00076 
00077 int                  dlkFD;     // Directory lock FD
00078 int                  flkFD;     // Lock file lock FD
00079 };
00080 
00081 /******************************************************************************/
00082 /*                     C l a s s   X r d F r m F i l e s                      */
00083 /******************************************************************************/
00084   
00085 class  XrdFrmFiles
00086 {
00087 public:
00088 
00089 XrdFrmFileset *Get(int &rc, int noBase=0);
00090 
00091 static const int Recursive = 0x0001;   // List filesets recursively
00092 static const int CompressD = 0x0002;   // Use shared directory object (not MT)
00093 static const int NoAutoDel = 0x0004;   // Do not automatically delete objects
00094 
00095             XrdFrmFiles(const char *dname, int opts=Recursive,
00096                         XrdOucTList *XList=0, XrdOucNSWalk::CallBack *cbP=0);
00097 
00098            ~XrdFrmFiles() {}
00099 
00100 private:
00101 int  Process(XrdOucNSWalk::NSEnt *nP, const char *dPath);
00102 
00103 XrdOucHash<XrdFrmFileset>fsTab;
00104 
00105 XrdOucNSWalk             nsObj;
00106 XrdFrmFileset           *fsList;
00107 XrdOucHash_Options       manMem;
00108 int                      shareD;
00109 };
00110 #endif

Generated on Wed Sep 1 2010 for xrootd by  doxygen 1.7.1