xrootd
XrdCmsManTree.hh
Go to the documentation of this file.
1 #ifndef __XRDCMSMANTREE_HH_
2 #define __XRDCMSMANTREE_HH_
3 /******************************************************************************/
4 /* */
5 /* X r d C m s M a n T r e 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 "XrdCms/XrdCmsManager.hh"
34 #include "XrdSys/XrdSysPthread.hh"
35 
36 class XrdCmsNode;
37 
39 {
40 public:
41 
42 int Connect(int nID, XrdCmsNode *nP);
43 
44 void Disc(int nID);
45 
46 int Register();
47 
48 void setMaxCon(int i);
49 
50 int Trying(int nID, int Lvl);
51 
53 
55  conLevel(0), conNID(-1), numWaiting(0),
56  myStatus(Active) {};
58 
59 private:
60 
61 void Redrive(int nID) {tmInfo[nID].Status = Active;
62  tmInfo[nID].theSem.Post();
63  numWaiting--;
64  }
65 void Pause(int nID) {tmInfo[nID].Status = Waiting;
66  numWaiting++;
67  myMutex.UnLock();
68  tmInfo[nID].theSem.Wait();
69  }
70 
72 
73 
74 struct TreeInfo
78  int Level;
79 
80  TreeInfo() : theSem(0), nodeP(0), Status(None), Level(0) {};
81  ~TreeInfo() {};
82 
84 
85 char buff[8];
86 int maxTMI;
87 int numConn;
88 int maxConn;
89 int atRoot;
91 int conNID;
94 };
95 
96 namespace XrdCms
97 {
98 extern XrdCmsManTree ManTree;
99 }
100 #endif