xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 void Abort();
43 
44 int Connect(int nID, XrdCmsNode *nP);
45 
46 void Disc(int nID);
47 
48 int Register();
49 
50 int Trying(int nID, int Lvl);
51 
53 
54  XrdCmsManTree(int maxC);
56 
57 private:
58 
59 void Redrive(int nID) {tmInfo[nID].Status = Active;
60  tmInfo[nID].theSem.Post();
61  numWaiting--;
62  }
63 void Pause(int nID) {tmInfo[nID].Status = Waiting;
64  numWaiting++;
65  myMutex.UnLock();
66  tmInfo[nID].theSem.Wait();
67  }
68 
70 
71 
72 struct TreeInfo
76  int Level;
77 
78  TreeInfo() : theSem(0), nodeP(0), Status(None), Level(0) {};
79  ~TreeInfo() {};
80 
82 
83 char buff[16];
84 int maxTMI;
85 int numConn;
86 int maxConn;
87 int atRoot;
89 int conNID;
92 };
93 #endif
struct XrdCmsManTree::TreeInfo tmInfo[XrdCmsManager::MTMax]
Definition: XrdCmsManTree.hh:38
int maxTMI
Definition: XrdCmsManTree.hh:84
XrdCmsManTree(int maxC)
Definition: XrdCmsManTree.hh:52
int conLevel
Definition: XrdCmsManTree.hh:88
int atRoot
Definition: XrdCmsManTree.hh:87
int numConn
Definition: XrdCmsManTree.hh:85
connStat
Definition: XrdCmsManTree.hh:52
~XrdCmsManTree()
Definition: XrdCmsManTree.hh:55
connStat Status
Definition: XrdCmsManTree.hh:75
connStat myStatus
Definition: XrdCmsManTree.hh:91
int maxConn
Definition: XrdCmsManTree.hh:86
void Wait()
Definition: XrdSysPthread.hh:509
int numWaiting
Definition: XrdCmsManTree.hh:90
Definition: XrdCmsManTree.hh:52
TreeInfo()
Definition: XrdCmsManTree.hh:78
Definition: XrdCmsManTree.hh:52
XrdSysSemaphore theSem
Definition: XrdCmsManTree.hh:73
Definition: XrdCmsManTree.hh:52
Definition: XrdSysPthread.hh:164
~TreeInfo()
Definition: XrdCmsManTree.hh:79
XrdCmsNode * nodeP
Definition: XrdCmsManTree.hh:74
void Post()
Definition: XrdSysPthread.hh:505
int Level
Definition: XrdCmsManTree.hh:76
Definition: XrdSysPthread.hh:493
Definition: XrdCmsManTree.hh:52
XrdSysMutex myMutex
Definition: XrdCmsManTree.hh:69
int Trying(int nID, int Lvl)
Definition: XrdCmsManTree.hh:52
static const int MTMax
Definition: XrdCmsManager.hh:63
void Redrive(int nID)
Definition: XrdCmsManTree.hh:59
Definition: XrdCmsNode.hh:57
char buff[16]
Definition: XrdCmsManTree.hh:83
void UnLock()
Definition: XrdSysPthread.hh:224
void Disc(int nID)
int Connect(int nID, XrdCmsNode *nP)
Definition: XrdCmsManTree.hh:72
void Pause(int nID)
Definition: XrdCmsManTree.hh:63
int conNID
Definition: XrdCmsManTree.hh:89