xrootd
XrdCmsFinder.hh
Go to the documentation of this file.
1 #ifndef __CMS_FINDER__
2 #define __CMS_FINDER__
3 /******************************************************************************/
4 /* */
5 /* X r d C m s F i n d e r . 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/XrdCmsClient.hh"
34 #include "XrdCms/XrdCmsPerfMon.hh"
35 
36 #include "XrdSys/XrdSysPthread.hh"
37 
38 class XrdCmsClientMan;
39 class XrdOss;
40 class XrdOucEnv;
41 class XrdOucErrInfo;
42 class XrdOucTList;
43 struct XrdCmsData;
44 class XrdCmsRRData;
45 struct XrdSfsPrep;
46 class XrdSysLogger;
47 struct XrdVersionInfo;
48 
49 /******************************************************************************/
50 /* R e m o t e F i n d e r */
51 /******************************************************************************/
52 
54 {
55 public:
56  void Added(const char *path, int Pend=0) {}
57 
58  int Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo);
59 
60  int Forward(XrdOucErrInfo &Resp, const char *cmd,
61  const char *arg1=0, const char *arg2=0,
62  XrdOucEnv *Env1=0, XrdOucEnv *Env2=0);
63 
64  int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
65  XrdOucEnv *Info=0);
66 
68 
69  int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs,
70  XrdOucEnv *Info=0);
71 
72  void Removed(const char *path) {}
73 
74  void setSS(XrdOss *thess) {}
75 
76  int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *Info=0);
77 
78 static bool VCheck(XrdVersionInfo &urVersion);
79 
80  XrdCmsFinderRMT(XrdSysLogger *lp, int whoami=0, int Port=0);
82 
83 static const int MaxMan = 15;
84 
85 private:
86 int Decode(char **resp);
87 void Inform(XrdCmsClientMan *xman, struct iovec xmsg[], int xnum);
88 int LocLocal(XrdOucErrInfo &Resp, XrdOucEnv *Env);
89 XrdCmsClientMan *SelectManager(XrdOucErrInfo &Resp, const char *path);
91 int send2Man(XrdOucErrInfo &, const char *, struct iovec *, int);
93 
99 char *CMSPath;
106 int isMeta;
109 int myPort;
110 unsigned char SMode;
111 unsigned char sendID;
112 unsigned char savePath;
113 };
114 
115 /******************************************************************************/
116 /* T a r g e t F i n d e r */
117 /******************************************************************************/
118 
119 class XrdOucStream;
120 class XrdOucTList;
121 
123 {
124 public:
125  void Added(const char *path, int Pend=0);
126 
127  int Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo);
128 
129  int Locate(XrdOucErrInfo &Resp, const char *path, int flags,
130  XrdOucEnv *Info=0);
131 
132  int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs,
133  XrdOucEnv *Info=0) {return 0;}
134 
136 
137  void PutInfo(XrdCmsPerfMon::PerfInfo &perfInfo, bool alert=false);
138 
139  void Removed(const char *path);
140 
141  void Resume (int Perm=1);
142  void Suspend(int Perm=1);
143 
144  int Resource(int n);
145  int Reserve (int n);
146  int Release (int n);
147 
148  int RunAdmin(char *Path, const char *vnid);
149 
150  void *RunPM();
151 
152  int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *envP=0)
153  {return 0;}
154 
155  void *Start();
156 
157  void Utilization(unsigned int util, bool alert=false);
158 
159 static bool VCheck(XrdVersionInfo &urVersion);
160 
161  XrdCmsFinderTRG(XrdSysLogger *, int, int, XrdOss *theSS=0);
163 
164 private:
165 
166 void Hookup();
168 
170 char *CMSPath;
171 char *Login;
176 int resMax;
177 int resCur;
178 int myPort;
181 int Active;
184 };
185 #endif
XrdCmsFinderTRG::myData
XrdSysMutex myData
Definition: XrdCmsFinder.hh:174
XrdCmsFinderRMT::isProxy
int isProxy
Definition: XrdCmsFinder.hh:107
XrdCmsPerfMon::PerfInfo
Structure used for reporting performance metrics.
Definition: XrdCmsPerfMon.hh:81
XrdOss
Definition: XrdOss.hh:498
XrdCmsFinderTRG::isRedir
int isRedir
Definition: XrdCmsFinder.hh:179
XrdCmsFinderRMT::Prepare
int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs, XrdOucEnv *Info=0)
XrdCmsFinderTRG::Hookup
void Hookup()
XrdCmsFinderRMT::myManagers
XrdCmsClientMan * myManagers
Definition: XrdCmsFinder.hh:95
XrdCmsFinderRMT::Managers
XrdOucTList * Managers()
Definition: XrdCmsFinder.hh:67
XrdSysMutex
Definition: XrdSysPthread.hh:165
XrdCmsFinderTRG::Login
char * Login
Definition: XrdCmsFinder.hh:171
XrdCmsFinderTRG::RunPM
void * RunPM()
XrdSysPthread.hh
XrdCmsFinderRMT::myManTable
XrdCmsClientMan * myManTable[MaxMan]
Definition: XrdCmsFinder.hh:94
XrdCmsFinderTRG::XrdCmsFinderTRG
XrdCmsFinderTRG(XrdSysLogger *, int, int, XrdOss *theSS=0)
XrdCmsFinderRMT::isTarget
int isTarget
Definition: XrdCmsFinder.hh:108
XrdCmsFinderRMT::MaxMan
static const int MaxMan
Definition: XrdCmsFinder.hh:83
XrdCmsFinderTRG::Active
int Active
Definition: XrdCmsFinder.hh:181
XrdCmsFinderRMT::RepWait
int RepWait
Definition: XrdCmsFinder.hh:103
XrdCmsFinderRMT::SelectManFail
void SelectManFail(XrdOucErrInfo &Resp)
XrdCmsFinderRMT::Added
void Added(const char *path, int Pend=0)
Definition: XrdCmsFinder.hh:56
XrdCmsFinderRMT::send2Man
int send2Man(XrdOucErrInfo &, const char *, struct iovec *, int)
XrdCmsFinderRMT::FwdWait
int FwdWait
Definition: XrdCmsFinder.hh:104
XrdCmsFinderTRG::CMSPath
char * CMSPath
Definition: XrdCmsFinder.hh:170
XrdCmsClient
Definition: XrdCmsClient.hh:116
XrdCmsFinderRMT::VCheck
static bool VCheck(XrdVersionInfo &urVersion)
XrdCmsFinderTRG::RunAdmin
int RunAdmin(char *Path, const char *vnid)
XrdCmsFinderRMT::Locate
int Locate(XrdOucErrInfo &Resp, const char *path, int flags, XrdOucEnv *Info=0)
XrdCmsFinderTRG::CMSp
XrdOucStream * CMSp
Definition: XrdCmsFinder.hh:173
XrdCmsFinderTRG::Resource
int Resource(int n)
XrdCmsRRData
Definition: XrdCmsRRData.hh:52
Macaroons::Info
@ Info
Definition: XrdMacaroonsHandler.hh:18
XrdCmsFinderRMT::RepDelay
int RepDelay
Definition: XrdCmsFinder.hh:101
XrdCmsFinderTRG::Reserve
int Reserve(int n)
XrdOucStream
Definition: XrdOucStream.hh:47
XrdCmsFinderTRG::Start
void * Start()
XrdCmsFinderRMT::myManCount
int myManCount
Definition: XrdCmsFinder.hh:97
XrdCmsFinderTRG::Locate
int Locate(XrdOucErrInfo &Resp, const char *path, int flags, XrdOucEnv *Info=0)
XrdCmsFinderTRG
Definition: XrdCmsFinder.hh:123
XrdCmsFinderTRG::Added
void Added(const char *path, int Pend=0)
XrdCmsFinderTRG::Removed
void Removed(const char *path)
XrdCmsFinderTRG::Space
int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *envP=0)
Definition: XrdCmsFinder.hh:152
XrdCmsFinderTRG::resCur
int resCur
Definition: XrdCmsFinder.hh:177
XrdCmsFinderTRG::Suspend
void Suspend(int Perm=1)
XrdCmsFinderTRG::Utilization
void Utilization(unsigned int util, bool alert=false)
XrdCmsFinderRMT
Definition: XrdCmsFinder.hh:54
XrdCmsFinderRMT::RepNone
int RepNone
Definition: XrdCmsFinder.hh:102
XrdCmsFinderTRG::resMax
int resMax
Definition: XrdCmsFinder.hh:176
XrdCmsFinderRMT::LocLocal
int LocLocal(XrdOucErrInfo &Resp, XrdOucEnv *Env)
XrdCmsClient.hh
XrdCmsFinderTRG::perfMon
XrdCmsPerfMon * perfMon
Definition: XrdCmsFinder.hh:182
XrdCmsFinderTRG::myManList
XrdOucTList * myManList
Definition: XrdCmsFinder.hh:172
XrdCmsFinderTRG::rrMutex
XrdSysMutex rrMutex
Definition: XrdCmsFinder.hh:175
XrdOucEnv
Definition: XrdOucEnv.hh:42
XrdCmsFinderTRG::VCheck
static bool VCheck(XrdVersionInfo &urVersion)
XrdSysLogger
Definition: XrdSysLogger.hh:53
XrdCmsFinderRMT::Configure
int Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo)
XrdCmsFinderTRG::myPort
int myPort
Definition: XrdCmsFinder.hh:178
XrdCmsFinderRMT::StartManagers
int StartManagers(XrdOucTList *)
XrdCmsFinderTRG::Release
int Release(int n)
XrdCmsFinderRMT::Space
int Space(XrdOucErrInfo &Resp, const char *path, XrdOucEnv *Info=0)
XrdCmsPerfMon
Definition: XrdCmsPerfMon.hh:46
XrdCmsFinderRMT::PrepWait
int PrepWait
Definition: XrdCmsFinder.hh:105
XrdCmsFinderTRG::Prepare
int Prepare(XrdOucErrInfo &Resp, XrdSfsPrep &pargs, XrdOucEnv *Info=0)
Definition: XrdCmsFinder.hh:132
XrdCmsFinderRMT::isMeta
int isMeta
Definition: XrdCmsFinder.hh:106
XrdCmsFinderRMT::setSS
void setSS(XrdOss *thess)
Definition: XrdCmsFinder.hh:74
XrdSfsPrep
< Prepare parameters
Definition: XrdSfsInterface.hh:168
XrdCmsFinderTRG::Managers
XrdOucTList * Managers()
Definition: XrdCmsFinder.hh:135
XrdCmsFinderTRG::perfInt
int perfInt
Definition: XrdCmsFinder.hh:183
XrdCmsFinderTRG::PutInfo
void PutInfo(XrdCmsPerfMon::PerfInfo &perfInfo, bool alert=false)
XrdCmsFinderTRG::SS
XrdOss * SS
Definition: XrdCmsFinder.hh:169
XrdOucErrInfo
Definition: XrdOucErrInfo.hh:101
XrdCmsFinderRMT::Decode
int Decode(char **resp)
XrdCmsFinderTRG::isProxy
int isProxy
Definition: XrdCmsFinder.hh:180
XrdCmsFinderTRG::~XrdCmsFinderTRG
~XrdCmsFinderTRG()
XrdCmsFinderRMT::Forward
int Forward(XrdOucErrInfo &Resp, const char *cmd, const char *arg1=0, const char *arg2=0, XrdOucEnv *Env1=0, XrdOucEnv *Env2=0)
XrdCmsFinderRMT::SMode
unsigned char SMode
Definition: XrdCmsFinder.hh:110
XrdCmsFinderRMT::myManList
XrdOucTList * myManList
Definition: XrdCmsFinder.hh:96
XrdCmsFinderTRG::Resume
void Resume(int Perm=1)
XrdCmsFinderRMT::~XrdCmsFinderRMT
~XrdCmsFinderRMT()
XrdCmsFinderTRG::Process
int Process(XrdCmsRRData &Data)
XrdCmsFinderRMT::CMSPath
char * CMSPath
Definition: XrdCmsFinder.hh:99
XrdCmsFinderRMT::Inform
void Inform(XrdCmsClientMan *xman, struct iovec xmsg[], int xnum)
XrdCmsFinderRMT::myData
XrdSysMutex myData
Definition: XrdCmsFinder.hh:98
XrdCmsPerfMon.hh
XrdCmsFinderRMT::XrdCmsFinderRMT
XrdCmsFinderRMT(XrdSysLogger *lp, int whoami=0, int Port=0)
XrdCmsFinderRMT::sendID
unsigned char sendID
Definition: XrdCmsFinder.hh:111
XrdCmsFinderRMT::ConWait
int ConWait
Definition: XrdCmsFinder.hh:100
XrdOucTList
Definition: XrdOucTList.hh:42
XrdCmsFinderRMT::Removed
void Removed(const char *path)
Definition: XrdCmsFinder.hh:72
XrdCmsFinderRMT::SelectManager
XrdCmsClientMan * SelectManager(XrdOucErrInfo &Resp, const char *path)
XrdCmsFinderRMT::savePath
unsigned char savePath
Definition: XrdCmsFinder.hh:112
XrdCmsFinderRMT::myPort
int myPort
Definition: XrdCmsFinder.hh:109
XrdCmsFinderTRG::Configure
int Configure(const char *cfn, char *Args, XrdOucEnv *EnvInfo)
XrdCmsClientMan
Definition: XrdCmsClientMan.hh:48