00001 #ifndef __CMS_PREPARE__H 00002 #define __CMS_PREPARE__H 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C m s P r e p a r e . h h */ 00006 /* */ 00007 /* (c) 2007 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 #include "Xrd/XrdJob.hh" 00014 #include "Xrd/XrdScheduler.hh" 00015 00016 #include "XrdCms/XrdCmsPrepArgs.hh" 00017 #include "XrdOuc/XrdOucHash.hh" 00018 #include "XrdOuc/XrdOucStream.hh" 00019 #include "XrdSys/XrdSysPthread.hh" 00020 00021 class XrdFrmProxy; 00022 class XrdNetMsg; 00023 class XrdOucMsubs; 00024 class XrdOucName2Name; 00025 00026 class XrdCmsPrepare : public XrdJob 00027 { 00028 public: 00029 00030 int Add(XrdCmsPrepArgs &pargs); 00031 00032 int Del(char *reqid); 00033 00034 int Exists(char *path); 00035 00036 void Gone(char *path); 00037 00038 void DoIt(); 00039 00040 void Inform(const char *cmd, XrdCmsPrepArgs *pargs); 00041 00042 int isOK() {return prepOK;} 00043 00044 int Pending() {return NumFiles;} 00045 00046 void Prepare(XrdCmsPrepArgs *pargs); 00047 00048 void Reset(const char *iName, const char *aPath, int aMode); 00049 00050 int setParms(int rcnt, int stime, int deco=0); 00051 00052 int setParms(const char *ifpgm, char *ifmsg=0); 00053 00054 int setParms(XrdOucName2Name *n2n) {N2N = n2n; return 0;} 00055 00056 XrdCmsPrepare(); 00057 ~XrdCmsPrepare() {} // Never gets deleted 00058 00059 private: 00060 00061 int isOnline(char *path); 00062 void Reset(); 00063 void Scrub(); 00064 int startIF(); 00065 00066 XrdSysMutex PTMutex; 00067 XrdOucHash<char> PTable; 00068 XrdOucStream prepSched; 00069 XrdOucName2Name *N2N; 00070 XrdOucMsubs *prepMsg; 00071 XrdNetMsg *Relay; 00072 XrdFrmProxy *PrepFrm; 00073 char *prepif; 00074 time_t lastemsg; 00075 pid_t preppid; 00076 int prepOK; 00077 int NumFiles; 00078 int doEcho; 00079 int resetcnt; 00080 int scrub2rst; 00081 int scrubtime; 00082 }; 00083 00084 namespace XrdCms 00085 { 00086 extern XrdCmsPrepare PrepQ; 00087 } 00088 #endif