00001 #ifndef __XRDCMSSTATE_H_ 00002 #define __XRDCMSSTATE_H_ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C m s S t a t 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: XrdCmsState.hh 30749 2009-10-15 16:33:04Z brun $ 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; // Minimum number of needed subscribers 00060 int numActive; // Number of active subscribers 00061 int numStaging; // Number of subscribers that can stage 00062 int dataPort; // Current data port number 00063 00064 char currState; // Current state 00065 char prevState; // Previous state 00066 char feOK; // Front end functioning 00067 char noSpace; // We don't have enough space 00068 char adminSuspend; // Admin asked for suspension 00069 char adminNoStage; // Admin asked for no staging 00070 char isMan; // We are a manager (i.e., have redirectors) 00071 char Enabled; // We are now enabled for reporting 00072 }; 00073 00074 namespace XrdCms 00075 { 00076 extern XrdCmsState CmsState; 00077 } 00078 #endif