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