XRootD
XrdCmsFinderRMT Class Reference

#include <XrdCmsFinder.hh>

+ Inheritance diagram for XrdCmsFinderRMT:
+ Collaboration diagram for XrdCmsFinderRMT:

Public Member Functions

 XrdCmsFinderRMT (XrdSysLogger *lp, int whoami=0, int Port=0)
 
 ~XrdCmsFinderRMT ()
 
void Added (const char *path, int Pend=0)
 
int Configure (const char *cfn, char *Args, XrdOucEnv *EnvInfo)
 
int Forward (XrdOucErrInfo &Resp, const char *cmd, const char *arg1=0, const char *arg2=0, XrdOucEnv *Env1=0, XrdOucEnv *Env2=0)
 
int Locate (XrdOucErrInfo &Resp, const char *path, int flags, XrdOucEnv *Info=0)
 
XrdOucTListManagers ()
 
int Prepare (XrdOucErrInfo &Resp, XrdSfsPrep &pargs, XrdOucEnv *Info=0)
 
void Removed (const char *path)
 
void setSS (XrdOss *thess)
 
int Space (XrdOucErrInfo &Resp, const char *path, XrdOucEnv *Info=0)
 
- Public Member Functions inherited from XrdCmsClient
 XrdCmsClient (Persona acting)
 
virtual ~XrdCmsClient ()
 Destructor. More...
 
virtual int isRemote ()
 
virtual int Release (int n=1)
 
virtual int Reserve (int n=1)
 
virtual int Resource (int n)
 
virtual void Resume (int Perm=1)
 
virtual void Suspend (int Perm=1)
 
virtual void Utilization (unsigned int util, bool alert=false)
 

Static Public Member Functions

static bool VCheck (XrdVersionInfo &urVersion)
 

Static Public Attributes

static const int MaxMan = 15
 

Additional Inherited Members

- Public Types inherited from XrdCmsClient
enum  Persona {
  amLocal ,
  amRemote ,
  amTarget
}
 
- Protected Attributes inherited from XrdCmsClient
Persona myPersona
 

Detailed Description

Definition at line 53 of file XrdCmsFinder.hh.

Constructor & Destructor Documentation

◆ XrdCmsFinderRMT()

XrdCmsFinderRMT::XrdCmsFinderRMT ( XrdSysLogger lp,
int  whoami = 0,
int  Port = 0 
)

Definition at line 103 of file XrdCmsFinder.cc.

105 {
106  myManagers = 0;
107  myManCount = 0;
108  myManList = 0;
109  myPort = Port;
110  SMode = 0;
111  sendID = 0;
112  isMeta = whoami & IsMeta;
113  isProxy = whoami & IsProxy;
114  isTarget = whoami & IsTarget;
115  savePath = 0;
116  Say.logger(lp);
117  Trace.SetLogger(lp);
118 }
XrdCmsClient(Persona acting)
@ amRemote
Am a manager and issue redirects.
XrdSysLogger * logger(XrdSysLogger *lp=0)
Definition: XrdSysError.hh:141
void SetLogger(XrdSysLogger *logp)
Definition: XrdSysTrace.cc:65
@ IsTarget
The role is server and will be a redirection target.
@ IsProxy
The role is proxy {plus one or more of the below}.
@ IsMeta
The role is meta {plus one or more of the above}.
XrdSysTrace Trace("cms")
XrdSysError Say(0, "cms_")

References XrdCms::IsMeta, XrdCms::IsProxy, XrdCms::IsTarget, XrdSysError::logger(), XrdCms::Say(), XrdSysTrace::SetLogger(), and XrdCms::Trace.

+ Here is the call graph for this function:

◆ ~XrdCmsFinderRMT()

XrdCmsFinderRMT::~XrdCmsFinderRMT ( )

Definition at line 124 of file XrdCmsFinder.cc.

125 {
126  XrdCmsClientMan *mp, *nmp = myManagers;
127  XrdOucTList *tp, *tpp = myManList;
128 
129  while((mp = nmp)) {nmp = mp->nextManager(); delete mp;}
130 
131  while((tp = tpp)) {tpp = tp->next; delete tp;}
132 }
XrdCmsClientMan * nextManager()
XrdOucTList * next
Definition: XrdOucTList.hh:45

References XrdOucTList::next, and XrdCmsClientMan::nextManager().

+ Here is the call graph for this function:

Member Function Documentation

◆ Added()

void XrdCmsFinderRMT::Added ( const char *  path,
int  Pend = 0 
)
inlinevirtual

Notify the cms of a newly added file or a file whose state has changed on a data server node.

Parameters
pathThe logical file name.
PendWhen true, the file is scheduled to be present in the future (e.g. copied in).

Reimplemented from XrdCmsClient.

Definition at line 56 of file XrdCmsFinder.hh.

56 {}

◆ Configure()

int XrdCmsFinderRMT::Configure ( const char *  cfn,
char *  Parms,
XrdOucEnv EnvInfo 
)
virtual

Configure the client object.

Parameters
cfnThe configuration file name.
ParmsAny parameters specified in the cmslib directive. If none, the pointer may be null.
EnvInfoEnvironmental information of the caller.
Returns
Success !0 Failure =0

Implements XrdCmsClient.

Definition at line 138 of file XrdCmsFinder.cc.

139 {
140  XrdCmsClientConfig config;
143  XrdInet *netP;
144  int Topts = IsRedir;
145 
146 // Establish what we will be configuring
147 //
148  if (isProxy)
149  {How = XrdCmsClientConfig::configProxy; Topts |= IsProxy;}
150  else if (isMeta) How = XrdCmsClientConfig::configMeta;
152  What = (isTarget ? XrdCmsClientConfig::configSuper
154 
155 // Establish the network interface that the caller must provide
156 //
157  if (!envP || !(netP = (XrdInet *)envP->GetPtr("XrdInet*")))
158  {Say.Emsg("Finder", "Network not defined; unable to connect to cmsd.");
159  return 0;
160  }
163  XrdCmsSecurity::setSecFunc(envP->GetPtr("XrdSecGetProtocol*"));
164 
165 // Now call the configration object
166 //
167  if (config.Configure(cfn, What, How)) return 0;
168 
169 // Set configured values and start the managers
170 //
171  CMSPath = config.CMSPath;
172  RepDelay = config.RepDelay;
173  RepNone = config.RepNone;
174  RepWait = config.RepWait;
175  ConWait = config.ConWait;
176  FwdWait = config.FwdWait;
177  PrepWait = config.PrepWait;
178  if (isProxy)
179  {SMode = config.SModeP;
180  StartManagers(config.PanList);
181  config.PanList = 0;
182  }
183  else {SMode = config.SMode;
184  StartManagers(config.ManList);
185  config.ManList = 0;
186  }
187 
188 // If we are tracing or if redirect monitoring is enabled, we will need
189 // to save path information.
190 //
191  if (QTRACE(Redirect) || getenv("XRDMONRDR")) savePath = 1;
192 
193 // If we are a plain manager but have a meta manager then we must start
194 // a responder (that we will hide) to pass through the port number.
195 //
196  if (!isMeta && !isTarget && config.haveMeta)
197  {XrdCmsFinderTRG *Rsp = new XrdCmsFinderTRG(Say.logger(),Topts,myPort);
198  return Rsp->RunAdmin(CMSPath, config.myVNID);
199  }
200 
201 // All done
202 //
203  return 1;
204 }
#define QTRACE(act)
Definition: XrdCmsTrace.hh:49
int Configure(const char *cfn, configWhat What, configHow How)
static void setConfig(const char *cfn)
static void setNetwork(XrdInet *nP)
int RunAdmin(char *Path, const char *vnid)
static void setSecFunc(void *secfP)
void * GetPtr(const char *varname)
Definition: XrdOucEnv.cc:281
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
@ IsRedir
The role is manager and will redirect users.
XrdOucEnv * envP
Definition: XrdPss.cc:109

References XrdCmsClientConfig::CMSPath, XrdCmsClientConfig::configMan, XrdCmsClientConfig::configMeta, XrdCmsClientConfig::configNorm, XrdCmsClientConfig::configProxy, XrdCmsClientConfig::configSuper, XrdCmsClientConfig::Configure(), XrdCmsClientConfig::ConWait, XrdSysError::Emsg(), XrdProxy::envP, XrdCmsClientConfig::FwdWait, XrdOucEnv::GetPtr(), XrdCmsClientConfig::haveMeta, XrdCms::IsProxy, XrdCms::IsRedir, XrdSysError::logger(), XrdCmsClientConfig::ManList, XrdCmsClientConfig::myVNID, XrdCmsClientConfig::PanList, XrdCmsClientConfig::PrepWait, QTRACE, XrdCmsClientConfig::RepDelay, XrdCmsClientConfig::RepNone, XrdCmsClientConfig::RepWait, XrdCmsFinderTRG::RunAdmin(), XrdCms::Say(), XrdCmsClientMan::setConfig(), XrdCmsClientMan::setNetwork(), XrdCmsSecurity::setSecFunc(), XrdCmsClientConfig::SMode, and XrdCmsClientConfig::SModeP.

+ Here is the call graph for this function:

◆ Forward()

int XrdCmsFinderRMT::Forward ( XrdOucErrInfo Resp,
const char *  cmd,
const char *  arg1 = 0,
const char *  arg2 = 0,
XrdOucEnv Env1 = 0,
XrdOucEnv Env2 = 0 
)
virtual

Relay a meta-operation to all nodes in the cluster.

This method is only used on manager nodes and is enabled by the ofs.forward directive.

Parameters
RespObject where messages are to be returned.
cmdThe operation being performed (see table below). If it starts with a '+' then a response (2way) is needed. Otherwise, a best-effort is all that is all that is required and success can always be returned.
arg11st argument to cmd.
arg22nd argument to cmd, which may be null if none exists.
Env1Associated environmental information for arg1 (e.g., cgi info which can be retrieved by Env1->Env(<len>)).
Env2Associated environmental information for arg2 (e.g., cgi info which can be retrieved by Env1->Env(<len>)).
     cmd       arg1    arg2           cmd       arg1    arg2
     --------  ------  ------         --------  ------  ------
     [+]chmod  <path>  <mode %o>      [+]rmdir  <path>  0
     [+]mkdir  <path>  <mode %o>      [+]mv     <oldp>  <newp>
     [+]mkpath <path>  <mode %o>      [+]trunc  <path>  <size %lld>
     [+]rm     <path>  0
Returns
As explained under "return conventions".

Reimplemented from XrdCmsClient.

Definition at line 210 of file XrdCmsFinder.cc.

213 {
214  static XrdSysMutex fwdMutex;
215  static struct timeval fwdClk = {time(0),0};
216  static const int xNum = 12;
217 
218  XrdCmsClientMan *Manp;
219  XrdCmsRRData Data;
220  unsigned int iMan;
221  int iovcnt, is2way, doAll = 0, opQ1Len = 0, opQ2Len = 0;
222  char Work[xNum*12];
223  struct iovec xmsg[xNum];
224 
225 // Encode the request as a redirector command
226 //
227  if ((is2way = (*cmd == '+'))) cmd++;
228 
229  if (!strcmp("chmod", cmd)) Data.Request.rrCode = kYR_chmod;
230  else if (!strcmp("mkdir", cmd)) Data.Request.rrCode = kYR_mkdir;
231  else if (!strcmp("mkpath",cmd)) Data.Request.rrCode = kYR_mkpath;
232  else if (!strcmp("mv", cmd)){Data.Request.rrCode = kYR_mv; doAll=1;}
233  else if (!strcmp("rm", cmd)){Data.Request.rrCode = kYR_rm; doAll=1;}
234  else if (!strcmp("rmdir", cmd)){Data.Request.rrCode = kYR_rmdir; doAll=1;}
235  else if (!strcmp("trunc", cmd)) Data.Request.rrCode = kYR_trunc;
236  else {Say.Emsg("Finder", "Unable to forward '", cmd, "'.");
237  Resp.setErrInfo(EINVAL, "Internal error processing file.");
238  return SFS_ERROR;
239  }
240 
241 // Fill out the RR data structure
242 //
243  Data.Ident = (char *)(XrdCmsClientMan::doDebug ? Resp.getErrUser() : "");
244  Data.Path = (char *)arg1;
245  Data.Mode = (char *)arg2;
246  Data.Path2 = (char *)arg2;
247  Data.Opaque = (Env1 ? Env1->EnvTidy(opQ1Len) : 0);
248  Data.Opaque2 = (Env2 ? Env2->EnvTidy(opQ2Len) : 0);
249 
250 // Pack the arguments
251 //
252  if (!(iovcnt = Parser.Pack(int(Data.Request.rrCode), &xmsg[1], &xmsg[xNum],
253  (char *)&Data, Work)))
254  {Resp.setErrInfo(EINVAL, "Internal error processing file.");
255  return SFS_ERROR;
256  }
257 
258 // Insert the header into the stream
259 //
260  Data.Request.streamid = 0;
261  Data.Request.modifier = 0;
262  xmsg[0].iov_base = (char *)&Data.Request;
263  xmsg[0].iov_len = sizeof(Data.Request);
264 
265 // This may be a 2way message. If so, use the longer path.
266 //
267  if (is2way) return send2Man(Resp, (arg1 ? arg1 : "/"), xmsg, iovcnt+1);
268 
269 // Check if we have exceeded the maximum rate for requests. If we have, we
270 // will wait to repace the stream so as to not burden the cmsd.
271 //
272  if (doAll && FwdWait)
273  {struct timeval nowClk;
274  time_t Window;
275  fwdMutex.Lock();
276  gettimeofday(&nowClk, 0);
277  fwdClk.tv_sec = nowClk.tv_sec - fwdClk.tv_sec;
278  fwdClk.tv_usec = nowClk.tv_usec - fwdClk.tv_usec;
279  if (fwdClk.tv_usec < 0) {fwdClk.tv_sec--; fwdClk.tv_usec += 1000000;}
280  Window = fwdClk.tv_sec*1000 + fwdClk.tv_usec/1000;
281  if (Window < FwdWait) XrdSysTimer::Wait(FwdWait - Window);
282  fwdClk = nowClk;
283  fwdMutex.UnLock();
284  }
285 
286 // Select the right manager for this request
287 //
288  if (!(Manp = SelectManager(Resp, (arg1 ? arg1 : "/")))) return ConWait;
289 
290 // Send message and simply wait for the reply
291 //
292  if (Manp->Send(iMan, xmsg, iovcnt+1))
293  {if (doAll)
294  {Data.Request.modifier |= kYR_dnf;
295  Inform(Manp, xmsg, iovcnt+1);
296  }
297  return 0;
298  }
299 
300 // Indicate client should retry later
301 //
302  Resp.setErrInfo(RepDelay, "");
303  return RepDelay;
304 }
#define SFS_ERROR
int Send(unsigned int &iMan, char *msg, int mlen=0)
static char doDebug
static int Pack(int rnum, struct iovec *iovP, struct iovec *iovE, char *Base, char *Work)
char * Opaque2
Definition: XrdCmsRRData.hh:58
XrdCms::CmsRRHdr Request
Definition: XrdCmsRRData.hh:54
char * EnvTidy(int &envlen)
Definition: XrdOucEnv.cc:160
int setErrInfo(int code, const char *emsg)
const char * getErrUser()
static void Wait(int milliseconds)
Definition: XrdSysTimer.cc:227
kXR_char modifier
Definition: YProtocol.hh:85
XrdCmsParser Parser
kXR_char rrCode
Definition: YProtocol.hh:84
kXR_unt32 streamid
Definition: YProtocol.hh:83
@ kYR_dnf
Definition: YProtocol.hh:133
@ kYR_mkpath
Definition: YProtocol.hh:94
@ kYR_chmod
Definition: YProtocol.hh:91
@ kYR_rmdir
Definition: YProtocol.hh:99
@ kYR_mkdir
Definition: YProtocol.hh:93
@ kYR_rm
Definition: YProtocol.hh:98
@ kYR_trunc
Definition: YProtocol.hh:113
@ kYR_mv
Definition: YProtocol.hh:95

References XrdCmsClientMan::doDebug, XrdSysError::Emsg(), XrdOucEnv::EnvTidy(), XrdOucErrInfo::getErrUser(), XrdCmsRRData::Ident, XrdCms::kYR_chmod, XrdCms::kYR_dnf, XrdCms::kYR_mkdir, XrdCms::kYR_mkpath, XrdCms::kYR_mv, XrdCms::kYR_rm, XrdCms::kYR_rmdir, XrdCms::kYR_trunc, XrdSysMutex::Lock(), XrdCmsRRData::Mode, XrdCms::CmsRRHdr::modifier, XrdCmsRRData::Opaque, XrdCmsRRData::Opaque2, XrdCmsParser::Pack(), XrdCms::Parser, XrdCmsRRData::Path, XrdCmsRRData::Path2, XrdCmsRRData::Request, XrdCms::CmsRRHdr::rrCode, XrdCms::Say(), XrdCmsClientMan::Send(), XrdOucErrInfo::setErrInfo(), SFS_ERROR, XrdCms::CmsRRHdr::streamid, XrdSysMutex::UnLock(), and XrdSysTimer::Wait().

+ Here is the call graph for this function:

◆ Locate()

int XrdCmsFinderRMT::Locate ( XrdOucErrInfo Resp,
const char *  path,
int  flags,
XrdOucEnv Info = 0 
)
virtual

Retrieve file location information.

Parameters
RespObject where message or response is to be returned.
pathThe logical path whise location is wanted.
flagsOne or more of the following:
     SFS_O_LOCATE  - return the list of servers that have the file.
                     Otherwise, redirect to the best server for the file.
     SFS_O_NOWAIT  - w/ SFS_O_LOCATE return readily available info.
                     Otherwise, select online files only.
     SFS_O_CREAT   - file will be created.
     SFS_O_NOWAIT  - select server if file is online.
     SFS_O_REPLICA - a replica of the file will be made.
     SFS_O_STAT    - only stat() information wanted.
     SFS_O_TRUNC   - file will be truncated.

     For any the the above, additional flags are passed:
     SFS_O_META    - data will not change (inode operation only)
     SFS_O_RESET   - reset cached info and recaculate the location(s).
     SFS_O_WRONLY  - file will be only written    (o/w RDWR   or RDONLY).
     SFS_O_RDWR    - file may be read and written (o/w WRONLY or RDONLY).
InfoAssociated environmental information for arg2 (e.g., cgi info which can be retrieved by Env1->Env(<len>)).
Returns
As explained under "return conventions".

Implements XrdCmsClient.

Definition at line 334 of file XrdCmsFinder.cc.

336 {
337  static const int xNum = 12;
338 
339  XrdCmsRRData Data;
340  int n, iovcnt;
341  char Work[xNum*12];
342  struct iovec xmsg[xNum];
343  char *triedRC, *affmode;
344 
345 // Fill out the RR data structure
346 //
347  Data.Ident = (char *)(XrdCmsClientMan::doDebug ? Resp.getErrUser() : "");
348  Data.Path = (char *)path;
349  Data.Opaque = (Env ? Env->EnvTidy(n) : 0);
350  Data.Avoid = (Env ? Env->Get("tried") : 0);
351 
352 // Set options and command
353 //
354  if (flags & SFS_O_LOCATE)
355  {bool doAll = (flags & SFS_O_FORCE) != 0;
356  if (flags & SFS_O_LOCAL) return LocLocal(Resp, Env);
357  Data.Request.rrCode = kYR_locate;
358  Data.Opts = (flags & SFS_O_NOWAIT ? CmsLocateRequest::kYR_asap : 0)
359  | (flags & SFS_O_RESET ? CmsLocateRequest::kYR_refresh : 0);
360  if (Resp.getUCap() & XrdOucEI::uPrip)
361  Data.Opts |= CmsLocateRequest::kYR_prvtnet;
362  if (Resp.getUCap() & XrdOucEI::uIPv4)
363  {Data.Opts |= (Resp.getUCap() & XrdOucEI::uIPv64 || doAll
364  ? CmsLocateRequest::kYR_retipv46 : 0);
365  } else {
366  Data.Opts |= (Resp.getUCap() & XrdOucEI::uIPv64 || doAll
367  ? CmsLocateRequest::kYR_retipv64 :
368  CmsLocateRequest::kYR_retipv6);
369  }
370  if (flags & SFS_O_HNAME) Data.Opts |= CmsLocateRequest::kYR_retname;
371  if (flags & SFS_O_RAWIO) Data.Opts |= CmsLocateRequest::kYR_retuniq;
372  if (doAll) Data.Opts |= CmsLocateRequest::kYR_listall;
373  } else
374  { Data.Request.rrCode = kYR_select;
375  if (flags & SFS_O_TRUNC) Data.Opts = CmsSelectRequest::kYR_trunc;
376  else if (flags & SFS_O_CREAT)
377  { Data.Opts = CmsSelectRequest::kYR_create;
378  if (flags & SFS_O_REPLICA)
379  Data.Opts|= CmsSelectRequest::kYR_replica;
380  }
381  else if (flags & SFS_O_STAT) Data.Opts = CmsSelectRequest::kYR_stat;
382  else Data.Opts = 0;
383 
384  Data.Opts |= (flags & (SFS_O_WRONLY | SFS_O_RDWR)
385  ? CmsSelectRequest::kYR_write : CmsSelectRequest::kYR_read);
386 
387  if (flags & SFS_O_META) Data.Opts |= CmsSelectRequest::kYR_metaop;
388 
389  if (flags & SFS_O_NOWAIT) Data.Opts |= CmsSelectRequest::kYR_online;
390 
391  if (flags & SFS_O_RESET) Data.Opts |= CmsSelectRequest::kYR_refresh;
392 
393  if (flags & SFS_O_MULTIW) Data.Opts |= CmsSelectRequest::kYR_mwfiles;
394 
395  if (Env && (affmode = Env->Get("cms.aff")))
396  { if (*affmode == 'n') Data.Opts |= CmsSelectRequest::kYR_aNone;
397  else if (*affmode == 'S') Data.Opts |= CmsSelectRequest::kYR_aStrict;
398  else if (*affmode == 's') Data.Opts |= CmsSelectRequest::kYR_aStrong;
399  else if (*affmode == 'w') Data.Opts |= CmsSelectRequest::kYR_aWeak;
400  }
401 
402  if (Resp.getUCap() & XrdOucEI::uPrip)
403  Data.Opts |= CmsSelectRequest::kYR_prvtnet;
404  if (Resp.getUCap() & XrdOucEI::uIPv4)
405  {Data.Opts |= (Resp.getUCap() & XrdOucEI::uIPv64
406  ? CmsSelectRequest::kYR_retipv46 : 0);
407  } else {
408  Data.Opts |= (Resp.getUCap() & XrdOucEI::uIPv64
409  ? CmsSelectRequest::kYR_retipv64 :
410  CmsSelectRequest::kYR_retipv6);
411  }
412 
413  if (Data.Avoid && Env && (triedRC = Env->Get("triedrc")))
414  {char *comma = rindex(triedRC, ',');
415  if (comma) triedRC = comma+1;
416  if (!strcmp(triedRC, "enoent"))
417  Data.Opts |= CmsSelectRequest::kYR_tryMISS;
418  else if (!strcmp(triedRC, "ioerr"))
419  Data.Opts |= CmsSelectRequest::kYR_tryIOER;
420  else if (!strcmp(triedRC, "fserr"))
421  Data.Opts |= CmsSelectRequest::kYR_tryFSER;
422  else if (!strcmp(triedRC, "srverr"))
423  Data.Opts |= CmsSelectRequest::kYR_trySVER;
424  else if (!strcmp(triedRC, "resel"))
425  Data.Opts |= CmsSelectRequest::kYR_tryRSEL;
426  else if (!strcmp(triedRC, "reseg"))
427  Data.Opts |= CmsSelectRequest::kYR_tryRSEG;
428  }
429  }
430 
431 // Pack the arguments
432 //
433  if (!(iovcnt = Parser.Pack(int(Data.Request.rrCode), &xmsg[1], &xmsg[xNum],
434  (char *)&Data, Work)))
435  {Resp.setErrInfo(EINVAL, "Internal error processing file.");
436  return SFS_ERROR;
437  }
438 
439 // Insert the header into the stream
440 //
441  Data.Request.streamid = 0;
442  Data.Request.modifier = 0;
443  xmsg[0].iov_base = (char *)&Data.Request;
444  xmsg[0].iov_len = sizeof(Data.Request);
445 
446 // Send the 2way message
447 //
448  return send2Man(Resp, path, xmsg, iovcnt+1);
449 }
#define SFS_O_HNAME
#define SFS_O_RESET
#define SFS_O_STAT
#define SFS_O_META
#define SFS_O_FORCE
#define SFS_O_MULTIW
#define SFS_O_WRONLY
#define SFS_O_CREAT
#define SFS_O_LOCATE
#define SFS_O_RAWIO
#define SFS_O_RDWR
#define SFS_O_LOCAL
#define SFS_O_NOWAIT
#define SFS_O_REPLICA
#define SFS_O_TRUNC
if(Avsz)
unsigned int Opts
Definition: XrdCmsRRData.hh:65
@ kYR_select
Definition: YProtocol.hh:100
@ kYR_locate
Definition: YProtocol.hh:92
static const int uIPv64
ucap: Supports only IPv4 info
static const int uIPv4
ucap: Supports read redirects
static const int uPrip

References XrdCmsRRData::Avoid, XrdCmsClientMan::doDebug, XrdOucEnv::EnvTidy(), XrdOucEnv::Get(), XrdOucErrInfo::getErrUser(), XrdOucErrInfo::getUCap(), XrdCmsRRData::Ident, if(), XrdCms::kYR_locate, XrdCms::kYR_select, XrdCms::kYR_trunc, XrdCms::CmsRRHdr::modifier, XrdCmsRRData::Opaque, XrdCmsRRData::Opts, XrdCmsParser::Pack(), XrdCms::Parser, XrdCmsRRData::Path, XrdCmsRRData::Request, XrdCms::CmsRRHdr::rrCode, XrdOucErrInfo::setErrInfo(), SFS_ERROR, SFS_O_CREAT, SFS_O_FORCE, SFS_O_HNAME, SFS_O_LOCAL, SFS_O_LOCATE, SFS_O_META, SFS_O_MULTIW, SFS_O_NOWAIT, SFS_O_RAWIO, SFS_O_RDWR, SFS_O_REPLICA, SFS_O_RESET, SFS_O_STAT, SFS_O_TRUNC, SFS_O_WRONLY, XrdCms::CmsRRHdr::streamid, XrdOucEI::uIPv4, XrdOucEI::uIPv64, and XrdOucEI::uPrip.

+ Here is the call graph for this function:

◆ Managers()

XrdOucTList* XrdCmsFinderRMT::Managers ( )
inlinevirtual

Obtain the list of cmsd's being used by a manager node along with their associated index numbers, origin 1.

Returns
The list of cmsd's being used. The list is considered permanent and is not deleted.

Reimplemented from XrdCmsClient.

Definition at line 67 of file XrdCmsFinder.hh.

67 {return myManList;}

◆ Prepare()

int XrdCmsFinderRMT::Prepare ( XrdOucErrInfo Resp,
XrdSfsPrep pargs,
XrdOucEnv Info = 0 
)
virtual

Start the preparation of a file for future processing.

Parameters
RespObject where message or response is to be returned.
pargsInformation on which and how to prepare the file.
InfoAssociated environmental information.
Returns
As explained under "return conventions".

Reimplemented from XrdCmsClient.

Definition at line 528 of file XrdCmsFinder.cc.

530 {
531  EPNAME("Prepare")
532  static const int xNum = 16;
533  static XrdSysMutex prepMutex;
534 
535  XrdCmsRRData Data;
536  XrdOucTList *tp, *op;
537  XrdCmsClientMan *Manp = 0;
538 
539  unsigned int iMan;
540  int iovcnt = 0, NoteLen, n;
541  char Prty[1032], *NoteNum = 0, *colocp = 0;
542  char Work[xNum*12];
543  struct iovec xmsg[xNum];
544 
545 // Prefill the RR data structure and iovec
546 //
547  Data.Ident = (char *)(XrdCmsClientMan::doDebug ? Resp.getErrUser() : "");
548  Data.Reqid = pargs.reqid;
549  Data.Request.streamid = 0;
550  Data.Request.modifier = 0;
551  xmsg[0].iov_base = (char *)&Data.Request;
552  xmsg[0].iov_len = sizeof(Data.Request);
553 
554 // Check for a cancel request
555 //
556  if (!(tp = pargs.paths))
557  {Data.Request.rrCode = kYR_prepdel;
558  if (!(iovcnt = Parser.Pack(kYR_prepdel, &xmsg[1], &xmsg[xNum],
559  (char *)&Data, Work)))
560  {Resp.setErrInfo(EINVAL, "Internal error processing file.");
561  return SFS_ERROR;
562  }
563  if (!(Manp = SelectManager(Resp, 0))) return ConWait;
564  if (Manp->Send(iMan, (const struct iovec *)&xmsg, iovcnt+1)) return 0;
565  DEBUG("Finder: Failed to send prepare cancel to "
566  <<Manp->Name() <<" reqid=" <<pargs.reqid);
567  Resp.setErrInfo(RepDelay, "");
568  return RepDelay;
569  }
570 
571 // Set prepadd options
572 //
573  Data.Request.modifier =
574  (pargs.opts & Prep_STAGE ? CmsPrepAddRequest::kYR_stage : 0)
575  | (pargs.opts & Prep_WMODE ? CmsPrepAddRequest::kYR_write : 0)
576  | (pargs.opts & Prep_FRESH ? CmsPrepAddRequest::kYR_fresh : 0);
577 
578 // Set coloc information if staging wanted and there are atleast two paths
579 //
580 
581 // Set the prepadd mode
582 //
583  if (!pargs.notify || !(pargs.opts & Prep_SENDACK))
584  {Data.Mode = (char *)(pargs.opts & Prep_WMODE ? "wq" : "rq");
585  Data.Notify = (char *)"*";
586  NoteNum = 0;
587  } else {
588  NoteLen = strlen(pargs.notify);
589  Data.Notify = (char *)malloc(NoteLen+16);
590  strcpy(Data.Notify, pargs.notify);
591  NoteNum = Data.Notify+NoteLen; *NoteNum++ = '-';
592  if (pargs.opts & Prep_SENDERR)
593  Data.Mode = (char *)(pargs.opts & Prep_WMODE ? "wn" : "rn");
594  else Data.Mode = (char *)(pargs.opts & Prep_WMODE ? "wnq" : "rnq");
595  }
596 
597 // Set the priority (if co-locate, add in the co-locate path)
598 //
599  n = sprintf(Prty, "%d", (pargs.opts & Prep_PMASK));
600  if (pargs.opts & Prep_STAGE && pargs.opts & Prep_COLOC
601  && pargs.paths && pargs.paths->next)
602  {colocp = Prty + n;
603  strlcpy(colocp+1, pargs.paths->text, sizeof(Prty)-n-1);
604  }
605  Data.Prty = Prty;
606 
607 // Distribute out paths to the various managers
608 //
609  Data.Request.rrCode = kYR_prepadd;
610  op = pargs.oinfo;
611  while(tp)
612  {if (NoteNum) sprintf(NoteNum, "%d", tp->val);
613  Data.Path = tp->text;
614  if (op) {Data.Opaque = op->text; op = op->next;}
615  else Data.Opaque = 0;
616  if (!(iovcnt = Parser.Pack(kYR_prepadd, &xmsg[1], &xmsg[xNum],
617  (char *)&Data, Work))) break;
618  if (!(Manp = SelectManager(Resp, tp->text))) break;
619  DEBUG("Finder: Sending " <<Manp->Name() <<' ' <<Data.Reqid
620  <<' ' <<Data.Path);
621  if (!Manp->Send(iMan, (const struct iovec *)&xmsg, iovcnt+1)) break;
622  if ((tp = tp->next))
623  {prepMutex.Lock(); XrdSysTimer::Wait(PrepWait); prepMutex.UnLock();}
624  if (colocp) {Data.Request.modifier |= CmsPrepAddRequest::kYR_coloc;
625  *colocp = ' '; colocp = 0;
626  }
627  }
628 
629 // Check if all went well
630 //
631  if (NoteNum) free(Data.Notify);
632  if (!tp) return 0;
633 
634 // Decode the error condition
635 //
636  if (!Manp) return ConWait;
637 
638  if (!iovcnt)
639  {Say.Emsg("Finder", "Unable to send prepadd; too much data.");
640  Resp.setErrInfo(EINVAL, "Internal error processing file.");
641  return SFS_ERROR;
642  }
643 
644  Resp.setErrInfo(RepDelay, "");
645  DEBUG("Finder: Failed to send prepare to " <<(Manp ? Manp->Name() : "?")
646  <<" reqid=" <<pargs.reqid);
647  return RepDelay;
648 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
#define Prep_FRESH
#define Prep_SENDERR
char * notify
Notification path or 0.
XrdOucTList * paths
List of paths.
XrdOucTList * oinfo
1-to-1 correspondence of opaque info
#define Prep_WMODE
#define Prep_COLOC
#define Prep_STAGE
char * reqid
Request ID.
#define Prep_PMASK
#define Prep_SENDACK
int opts
Prep_xxx.
size_t strlcpy(char *dst, const char *src, size_t sz)
char * text
Definition: XrdOucTList.hh:46
@ kYR_prepdel
Definition: YProtocol.hh:97
@ kYR_prepadd
Definition: YProtocol.hh:96

References DEBUG, XrdCmsClientMan::doDebug, XrdSysError::Emsg(), EPNAME, XrdOucErrInfo::getErrUser(), XrdCmsRRData::Ident, XrdCms::kYR_prepadd, XrdCms::kYR_prepdel, XrdSysMutex::Lock(), XrdCmsRRData::Mode, XrdCms::CmsRRHdr::modifier, XrdCmsClientMan::Name(), XrdOucTList::next, XrdCmsRRData::Notify, XrdSfsPrep::notify, XrdSfsPrep::oinfo, XrdCmsRRData::Opaque, XrdSfsPrep::opts, XrdCmsParser::Pack(), XrdCms::Parser, XrdCmsRRData::Path, XrdSfsPrep::paths, Prep_COLOC, Prep_FRESH, Prep_PMASK, Prep_SENDACK, Prep_SENDERR, Prep_STAGE, Prep_WMODE, XrdCmsRRData::Prty, XrdCmsRRData::Reqid, XrdSfsPrep::reqid, XrdCmsRRData::Request, XrdCms::CmsRRHdr::rrCode, XrdCms::Say(), XrdCmsClientMan::Send(), XrdOucErrInfo::setErrInfo(), SFS_ERROR, XrdCms::CmsRRHdr::streamid, strlcpy(), XrdOucTList::text, XrdSysMutex::UnLock(), and XrdSysTimer::Wait().

+ Here is the call graph for this function:

◆ Removed()

void XrdCmsFinderRMT::Removed ( const char *  path)
inlinevirtual

Notify the cmsd that a file or directory has been deleted. It is only called called on a data server node.

Parameters
pathThe logical file name that was removed.

Reimplemented from XrdCmsClient.

Definition at line 72 of file XrdCmsFinder.hh.

72 {}

◆ setSS()

void XrdCmsFinderRMT::setSS ( XrdOss thess)
inline

Definition at line 74 of file XrdCmsFinder.hh.

74 {}

◆ Space()

int XrdCmsFinderRMT::Space ( XrdOucErrInfo Resp,
const char *  path,
XrdOucEnv Info = 0 
)
virtual

Obtain the overall space usage of a cluster. Called only on manager nodes.

Parameters
RespObject to hold response or error message.
pathAssociated logical path for the space request.
InfoAssociated cgi information for path.
Returns
Space information as defined by the response to kYR_statfs. For a typical implementation see XrdCmsNode::do_StatFS().

Implements XrdCmsClient.

Definition at line 837 of file XrdCmsFinder.cc.

838 {
839  static const int xNum = 4;
840 
841  XrdCmsRRData Data;
842  int iovcnt;
843  char Work[xNum*12];
844  struct iovec xmsg[xNum];
845 
846 // Fill out the RR data structure
847 //
848  Data.Ident = (char *)(XrdCmsClientMan::doDebug ? Resp.getErrUser() : "");
849  Data.Path = (char *)path;
850 
851 // Pack the arguments
852 //
853  if (!(iovcnt = Parser.Pack(kYR_statfs, &xmsg[1], &xmsg[xNum],
854  (char *)&Data, Work)))
855  {Resp.setErrInfo(EINVAL, "Internal error processing file.");
856  return SFS_ERROR;
857  }
858 
859 // Insert the header into the stream
860 //
861  Data.Request.rrCode = kYR_statfs;
862  Data.Request.streamid = 0;
863  Data.Request.modifier = (eP && eP->Get("cms.qvfs")
864  ? CmsStatfsRequest::kYR_qvfs : 0);
865  xmsg[0].iov_base = (char *)&Data.Request;
866  xmsg[0].iov_len = sizeof(Data.Request);
867 
868 // Send the 2way message
869 //
870  return send2Man(Resp, path, xmsg, iovcnt+1);
871 }
@ kYR_statfs
Definition: YProtocol.hh:111

References XrdCmsClientMan::doDebug, XrdOucEnv::Get(), XrdOucErrInfo::getErrUser(), XrdCmsRRData::Ident, XrdCms::kYR_statfs, XrdCms::CmsRRHdr::modifier, XrdCmsParser::Pack(), XrdCms::Parser, XrdCmsRRData::Path, XrdCmsRRData::Request, XrdCms::CmsRRHdr::rrCode, XrdOucErrInfo::setErrInfo(), SFS_ERROR, and XrdCms::CmsRRHdr::streamid.

+ Here is the call graph for this function:

◆ VCheck()

bool XrdCmsFinderRMT::VCheck ( XrdVersionInfo &  urVersion)
static

Definition at line 877 of file XrdCmsFinder.cc.

878 {
879  return XrdSysPlugin::VerCmp(urVersion, myVersion);
880 }
static bool VerCmp(XrdVersionInfo &vInf1, XrdVersionInfo &vInf2, bool noMsg=false)
XrdVersionInfo myVersion

References XrdCms::myVersion, and XrdSysPlugin::VerCmp().

+ Here is the call graph for this function:

Member Data Documentation

◆ MaxMan

const int XrdCmsFinderRMT::MaxMan = 15
static

Definition at line 83 of file XrdCmsFinder.hh.


The documentation for this class was generated from the following files: