00001 #ifndef __XRDCMSSTATE_H_
00002 #define __XRDCMSSTATE_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "XrdSys/XrdSysPthread.hh"
00016 #include "XrdCms/XrdCmsTypes.hh"
00017
00018 class XrdLink;
00019
00020 class XrdCmsState
00021 {
00022 public:
00023
00024 int Suspended;
00025 int NoStaging;
00026
00027 void Enable();
00028
00029 void *Monitor();
00030
00031 int Port();
00032
00033 void sendState(XrdLink *Link);
00034
00035 void Set(int ncount);
00036 void Set(int ncount, int isman, const char *AdminPath);
00037
00038 enum StateType {Active = 0, Counts, FrontEnd, Space, Stage};
00039
00040 void Update(StateType StateT, int ActivVal, int StageVal=0);
00041
00042 XrdCmsState();
00043 ~XrdCmsState() {}
00044
00045 static const char SRV_Suspend = 1;
00046 static const char FES_Suspend = 2;
00047 static const char All_Suspend = 3;
00048 static const char All_NoStage = 4;
00049
00050 private:
00051 unsigned char Status(int Changes, int theState);
00052
00053 XrdSysSemaphore mySemaphore;
00054 XrdSysMutex myMutex;
00055
00056 const char *NoStageFile;
00057 const char *SuspendFile;
00058
00059 int minNodeCnt;
00060 int numActive;
00061 int numStaging;
00062 int dataPort;
00063
00064 char currState;
00065 char prevState;
00066 char feOK;
00067 char noSpace;
00068 char adminSuspend;
00069 char adminNoStage;
00070 char isMan;
00071 char Enabled;
00072 };
00073
00074 namespace XrdCms
00075 {
00076 extern XrdCmsState CmsState;
00077 }
00078 #endif