XrdFrmPurge.hh

Go to the documentation of this file.
00001 #ifndef __FRMPURGE__
00002 #define __FRMPURGE__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                        X r d F r m P u r g e . 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: XrdFrmPurge.hh 35287 2010-09-14 21:19:35Z ganis $
00014 
00015 #include <time.h>
00016 #include <sys/types.h>
00017 
00018 #include "XrdFrm/XrdFrmTSort.hh"
00019 #include "XrdOss/XrdOssSpace.hh"
00020 #include "XrdOuc/XrdOucHash.hh"
00021 
00022 class XrdFrmFileset;
00023 class XrdOucPolProg;
00024 class XrdOucStream;
00025 class XrdOucTList;
00026 
00027 class XrdFrmPurge
00028 {
00029 public:
00030 
00031 static void          Display();
00032 
00033 static int           Init(XrdOucTList *sP=0, long long minV=-1, int hVal=-1);
00034 
00035 static XrdFrmPurge  *Policy(const char *sname) {return Find(sname);}
00036 static XrdFrmPurge  *Policy(const char *sname, long long minV, long long maxV,
00037                                                int hVal, int xVal);
00038 
00039 static void          Purge();
00040 
00041                      XrdFrmPurge(const char *snp, XrdFrmPurge *spp=0);
00042                     ~XrdFrmPurge() {Clear();}
00043 
00044 private:
00045 
00046 // Methods
00047 //
00048 static void          Add(XrdFrmFileset *fsp);
00049        XrdFrmFileset*Advance();
00050        void          Clear();
00051        void          Defer(XrdFrmFileset *sP, time_t xTime);
00052 const  char         *Eligible(XrdFrmFileset *sP, time_t &xTime, int hTime=0);
00053 static XrdFrmPurge  *Find(const char *snp);
00054 static int           LowOnSpace();
00055        int           PurgeFile();
00056 static void          Remfix(const char *Ftype, const char *Fname);
00057 static void          Scan();
00058 static int           Screen(XrdFrmFileset *sP, int needLF);
00059 static void          Stats(int Final);
00060        void          Track(XrdFrmFileset *sP);
00061 const  char         *XPolOK(XrdFrmFileset *sP);
00062 static XrdOucProg   *PolProg;
00063 static XrdOucStream *PolStream;
00064 
00065 // Static Variables
00066 
00067 static XrdOucHash<char> BadFiles;
00068 static time_t        lastReset;
00069 static time_t        nextReset;
00070 
00071 static XrdFrmPurge  *First;
00072 static XrdFrmPurge  *Default;
00073 
00074 static int           Left2Do;
00075 
00076 // Variables local to each object
00077 //
00078 long long            freeSpace;      // Current free space
00079 long long            fconMaxsp;      // Current free space contiguous
00080 long long            usedSpace;      // Curreny used space (if supported)
00081 long long            pmaxSpace;      // PMax  space (computed once)
00082 long long            totlSpace;      // Total space (computed once)
00083 long long            contSpace;      // Total contg (computed once)
00084 long long            purgBytes;      // Purged bytes on last purge cycle
00085 long long            minFSpace;      // Minimum free space
00086 long long            maxFSpace;      // Maximum free space (what we purge to)
00087 char                *spaceTotl;
00088 char                *spaceTotP;
00089 int                  spaceTLen;
00090 int                  spaceTLep;
00091 int                  Hold;           // Hold value
00092 int                  Hold2x;         // Hold x2 (what we actually use)
00093 int                  Ext;            // External policy applies
00094 int                  numFiles;       // Total number of files
00095 int                  prgFiles;       // Total number of purged
00096 int                  Enabled;
00097 int                  Stop;
00098 int                  SNlen;
00099 
00100 XrdFrmPurge         *Next;
00101 XrdFrmTSort          FSTab;
00102 char                 SName[XrdOssSpace::minSNbsz];
00103 
00104 static const int     DeferQsz = 16;
00105 XrdFrmFileset       *DeferQ[DeferQsz];
00106 time_t               DeferT[DeferQsz];
00107 };
00108 #endif

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