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