XRootD
XrdCmsState.hh
Go to the documentation of this file.
1 #ifndef __XRDCMSSTATE_H_
2 #define __XRDCMSSTATE_H_
3 /******************************************************************************/
4 /* */
5 /* X r d C m s S t a t e . h h */
6 /* */
7 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /* */
12 /* This file is part of the XRootD software suite. */
13 /* */
14 /* XRootD is free software: you can redistribute it and/or modify it under */
15 /* the terms of the GNU Lesser General Public License as published by the */
16 /* Free Software Foundation, either version 3 of the License, or (at your */
17 /* option) any later version. */
18 /* */
19 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22 /* License for more details. */
23 /* */
24 /* You should have received a copy of the GNU Lesser General Public License */
25 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27 /* */
28 /* The copyright holder's institutional names and contributor's names may not */
29 /* be used to endorse or promote products derived from this software without */
30 /* specific prior written permission of the institution or contributor. */
31 /******************************************************************************/
32 
33 #include "XrdSys/XrdSysPthread.hh"
34 #include "XrdCms/XrdCmsTypes.hh"
35 
36 class XrdLink;
37 
39 {
40 public:
41 
44 
45 void Enable();
46 
47 void *Monitor();
48 
49 int Port();
50 
51 void sendState(XrdLink *Link);
52 
53 void Set(int ncount);
54 void Set(int ncount, int isman, const char *AdminPath);
55 
57 
58 void Update(StateType StateT, int ActivVal, int StageVal=0);
59 
60  XrdCmsState();
62 
63 static const char SRV_Suspend = 1;
64 static const char FES_Suspend = 2;
65 static const char All_Suspend = 3;
66 static const char All_NoStage = 4;
67 
68 private:
69 unsigned char Status(int Changes, int theState);
70 
71 XrdSysSemaphore mySemaphore;
72 XrdSysMutex myMutex;
73 
74 const char *NoStageFile;
75 const char *SuspendFile;
76 
77 int minNodeCnt; // Minimum number of needed subscribers
78 int numActive; // Number of active subscribers
79 int numStaging; // Number of subscribers that can stage
80 int dataPort; // Current data port number
81 
82 char currState; // Current state
83 char prevState; // Previous state
84 char feOK; // Front end functioning
85 char noSpace; // We don't have enough space
86 char adminSuspend; // Admin asked for suspension
87 char adminNoStage; // Admin asked for no staging
88 char isMan; // We are a manager (i.e., have redirectors)
89 char Enabled; // We are now enabled for reporting
90 };
91 
92 namespace XrdCms
93 {
94 extern XrdCmsState CmsState;
95 }
96 #endif
static const char FES_Suspend
Definition: XrdCmsState.hh:64
static const char All_NoStage
Definition: XrdCmsState.hh:66
void * Monitor()
Definition: XrdCmsState.cc:111
void Update(StateType StateT, int ActivVal, int StageVal=0)
Definition: XrdCmsState.cc:258
static const char All_Suspend
Definition: XrdCmsState.hh:65
static const char SRV_Suspend
Definition: XrdCmsState.hh:63
void Set(int ncount)
Definition: XrdCmsState.cc:182
void Enable()
Definition: XrdCmsState.cc:85
void sendState(XrdLink *Link)
Definition: XrdCmsState.cc:161
XrdCmsState CmsState
Definition: XrdCmsState.cc:55