00001 #ifndef __CMS_FINDER__
00002 #define __CMS_FINDER__
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "XrdCms/XrdCmsClient.hh"
00034 #include "XrdCms/XrdCmsPerfMon.hh"
00035
00036 #include "XrdSys/XrdSysPthread.hh"
00037
00038 class XrdCmsClientMan;
00039 class XrdOss;
00040 class XrdOucEnv;
00041 class XrdOucErrInfo;
00042 class XrdOucTList;
00043 struct XrdCmsData;
00044 class XrdCmsRRData;
00045 struct XrdSfsPrep;
00046 class XrdSysLogger;
00047 struct XrdVersionInfo;
00048
00049
00050
00051
00052
00053 class XrdCmsFinderRMT : public XrdCmsClient
00054 {
00055 public:
00056 void Added(const char *path, int Pend=0) {}
00057
00058 int Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo);
00059
00060 int Forward(XrdOucErrInfo &Resp, const char *cmd,
00061 const char *arg1=0, const char *arg2=0,
00062 XrdOucEnv *Env1=0, XrdOucEnv *Env2=0);
00063
00064 int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00065 XrdOucEnv *Info=0);
00066
00067 XrdOucTList *Managers() {return myManList;}
00068
00069 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs,
00070 XrdOucEnv *Info=0);
00071
00072 void Removed(const char *path) {}
00073
00074 void setSS(XrdOss *thess) {}
00075
00076 int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *Info=0);
00077
00078 static bool VCheck(XrdVersionInfo &urVersion);
00079
00080 XrdCmsFinderRMT(XrdSysLogger *lp, int whoami=0, int Port=0);
00081 ~XrdCmsFinderRMT();
00082
00083 static const int MaxMan = 15;
00084
00085 private:
00086 int Decode(char **resp);
00087 void Inform(XrdCmsClientMan *xman, struct iovec xmsg[], int xnum);
00088 int LocLocal(XrdOucErrInfo &Resp, XrdOucEnv *Env);
00089 XrdCmsClientMan *SelectManager(XrdOucErrInfo &Resp, const char *path);
00090 void SelectManFail(XrdOucErrInfo &Resp);
00091 int send2Man(XrdOucErrInfo &, const char *, struct iovec *, int);
00092 int StartManagers(XrdOucTList *);
00093
00094 XrdCmsClientMan *myManTable[MaxMan];
00095 XrdCmsClientMan *myManagers;
00096 XrdOucTList *myManList;
00097 int myManCount;
00098 XrdSysMutex myData;
00099 char *CMSPath;
00100 int ConWait;
00101 int RepDelay;
00102 int RepNone;
00103 int RepWait;
00104 int FwdWait;
00105 int PrepWait;
00106 int isMeta;
00107 int isProxy;
00108 int isTarget;
00109 int myPort;
00110 unsigned char SMode;
00111 unsigned char sendID;
00112 unsigned char savePath;
00113 };
00114
00115
00116
00117
00118
00119 class XrdOucStream;
00120 class XrdOucTList;
00121
00122 class XrdCmsFinderTRG : public XrdCmsClient, public XrdCmsPerfMon
00123 {
00124 public:
00125 void Added(const char *path, int Pend=0);
00126
00127 int Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo);
00128
00129 int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
00130 XrdOucEnv *Info=0);
00131
00132 int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs,
00133 XrdOucEnv *Info=0) {return 0;}
00134
00135 XrdOucTList *Managers() {return myManList;}
00136
00137 void PutInfo(XrdCmsPerfMon::PerfInfo &perfInfo, bool alert=false);
00138
00139 void Removed(const char *path);
00140
00141 void Resume (int Perm=1);
00142 void Suspend(int Perm=1);
00143
00144 int Resource(int n);
00145 int Reserve (int n);
00146 int Release (int n);
00147
00148 int RunAdmin(char *Path, const char *vnid);
00149
00150 void *RunPM();
00151
00152 int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *envP=0)
00153 {return 0;}
00154
00155 void *Start();
00156
00157 void Utilization(unsigned int util, bool alert=false);
00158
00159 static bool VCheck(XrdVersionInfo &urVersion);
00160
00161 XrdCmsFinderTRG(XrdSysLogger *, int, int, XrdOss *theSS=0);
00162 ~XrdCmsFinderTRG();
00163
00164 private:
00165
00166 void Hookup();
00167 int Process(XrdCmsRRData &Data);
00168
00169 XrdOss *SS;
00170 char *CMSPath;
00171 char *Login;
00172 XrdOucTList *myManList;
00173 XrdOucStream *CMSp;
00174 XrdSysMutex myData;
00175 XrdSysMutex rrMutex;
00176 int resMax;
00177 int resCur;
00178 int myPort;
00179 int isRedir;
00180 int isProxy;
00181 int Active;
00182 XrdCmsPerfMon *perfMon;
00183 int perfInt;
00184 };
00185 #endif