XRootD
XrdFrmTransfer Class Reference

#include <XrdFrmTransfer.hh>

+ Collaboration diagram for XrdFrmTransfer:

Public Member Functions

 XrdFrmTransfer ()
 
 ~XrdFrmTransfer ()
 
void Start (int ioqType)
 

Static Public Member Functions

static const char * checkFF (const char *Path)
 
static int Init ()
 

Detailed Description

Definition at line 41 of file XrdFrmTransfer.hh.

Constructor & Destructor Documentation

◆ XrdFrmTransfer()

XrdFrmTransfer::XrdFrmTransfer ( )

Definition at line 107 of file XrdFrmTransfer.cc.

108 {
109  int i;
110 
111 // Construct program objects
112 //
113  for (i = 0; i < 4; i++)
114  xfrCmd[i] = (Config.xfrCmd[i].theVec ? new XrdOucProg(&Say) : 0);
115 }
XrdSysError Say
XrdCmsConfig Config

References XrdCms::Config, and XrdFrc::Say.

◆ ~XrdFrmTransfer()

XrdFrmTransfer::~XrdFrmTransfer ( )
inline

Definition at line 53 of file XrdFrmTransfer.hh.

53 {}

Member Function Documentation

◆ checkFF()

const char * XrdFrmTransfer::checkFF ( const char *  Path)
static

Definition at line 121 of file XrdFrmTransfer.cc.

122 {
123  EPNAME("checkFF");
124  struct stat buf;
125 
126 // Check for a fail file
127 //
128  if (!stat(Path, &buf))
129  {if (buf.st_ctime+Config.FailHold >= time(0))
130  return "request previously failed";
131  if (Config.Test) {DEBUG("would have removed '" <<Path <<"'");}
132  else {unlink(Path);
133  DEBUG("removed '" <<Path <<"'");
134  }
135  }
136 
137 // Return all is well
138 //
139  return 0;
140 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
int stat(const char *path, struct stat *buf)
int unlink(const char *path)
XrdOucString Path

References XrdCms::Config, DEBUG, EPNAME, Path, stat(), and unlink().

+ Here is the call graph for this function:

◆ Init()

int XrdFrmTransfer::Init ( )
static

Definition at line 408 of file XrdFrmTransfer.cc.

409 {
410  static int anyQ = XrdFrmXfrQueue::useAnyQ;
411  static int inpQ = XrdFrmXfrQueue::useInpQ;
412  static int outQ = XrdFrmXfrQueue::useOutQ;
413  void *qWant;
414  pthread_t tid;
415  int retc, n;
416 
417 // Initialize the cluster identification object first
418 //
419  CID.Init(Config.QPath);
420 
421 // Initialize the transfer queue first
422 //
423  if (!XrdFrmXfrQueue::Init()) return 0;
424 
425 // Start the required number of transfer threads. Note we can split these
426 // as dedicated in threads and dedicated out threads.
427 //
428  n = Config.xfrMax;
429  while(n--)
430  { if (Config.xfrMaxIn)
431  { qWant = (void *)&inpQ; Config.xfrMaxIn--;}
432  else if (Config.xfrMaxOt)
433  { qWant = (void *)&outQ; Config.xfrMaxOt--;}
434  else qWant = (void *)&anyQ;
435 
436  if ((retc = XrdSysThread::Run(&tid, InitXfer, qWant,
437  XRDSYSTHREAD_BIND, "transfer")))
438  {Say.Emsg("main", retc, "create xfr thread"); return 0;}
439  }
440 
441 // All done
442 //
443  return 1;
444 }
void * InitXfer(void *parg)
#define XRDSYSTHREAD_BIND
int Init(const char *qPath)
Definition: XrdFrcCID.cc:159
static const int useInpQ
static int Init()
static const int useOutQ
static const int useAnyQ
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition: XrdSysError.cc:95
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
XrdFrcCID CID
Definition: XrdFrcCID.cc:56

References XrdFrc::CID, XrdCms::Config, XrdSysError::Emsg(), XrdFrmXfrQueue::Init(), XrdFrcCID::Init(), InitXfer(), XrdSysThread::Run(), XrdFrc::Say, XrdFrmXfrQueue::useAnyQ, XrdFrmXfrQueue::useInpQ, XrdFrmXfrQueue::useOutQ, and XRDSYSTHREAD_BIND.

Referenced by XrdFrmXfrDaemon::Init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Start()

void XrdFrmTransfer::Start ( int  ioqType)

Definition at line 497 of file XrdFrmTransfer.cc.

498 {
499  EPNAME("Transfer"); // Wrong but looks better
500  const char *Msg;
501 
502 // Prime I/O queue selection
503 
504 // Endless loop looking for transfer jobs
505 //
506  while(1)
507  {xfrP = XrdFrmXfrQueue::Get(ioqType);
508 
509  DEBUG(xfrP->Type <<" starting " <<xfrP->reqData.LFN
510  <<" for " <<xfrP->reqData.User);
511 
512  Msg = (xfrP->qNum & XrdFrcRequest::outQ ? Throw() : Fetch());
513  if (Msg && !(xfrP->RetCode)) xfrP->RetCode = 1;
514  xfrP->PFN[xfrP->pfnEnd] = 0;
515 
516  if (xfrP->RetCode || Config.Verbose)
517  {char buff1[280], buff2[80];
518  sprintf(buff1, "%s for %s", xfrP->RetCode ? "failed" : "complete",
519  xfrP->reqData.User);
520  if (xfrP->RetCode == 0) *buff2 = 0;
521  else sprintf(buff2, "; %s", (Msg ? Msg : "reason unknown"));
522  Say.Say(0, xfrP->Type, buff1, xfrP->reqData.LFN,buff2);
523  } else {
524  DEBUG(xfrP->Type
525  <<(xfrP->RetCode ? " failed " : " complete ")
526  << xfrP->reqData.LFN <<" rc=" <<xfrP->RetCode
527  <<' ' <<(Msg ? Msg : ""));
528  }
529 
530  XrdFrmXfrQueue::Done(xfrP, Msg);
531  }
532 }
char PFN[MAXPATHLEN+16]
Definition: XrdFrmXfrJob.hh:50
const char * Type
Definition: XrdFrmXfrJob.hh:49
XrdFrcRequest reqData
Definition: XrdFrmXfrJob.hh:48
char LFN[3072]
char User[256]
static const int outQ
static void Done(XrdFrmXfrJob *xP, const char *Msg)
static XrdFrmXfrJob * Get(int ioQType)
void Say(const char *text1, const char *text2=0, const char *txt3=0, const char *text4=0, const char *text5=0, const char *txt6=0)
Definition: XrdSysError.cc:141

References XrdCms::Config, DEBUG, XrdFrmXfrQueue::Done(), EPNAME, XrdFrmXfrQueue::Get(), if(), XrdFrcRequest::outQ, XrdFrc::Say, and XrdSysError::Say().

Referenced by InitXfer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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