Loading...
Searching...
No Matches
XrdFrcReqAgent Class Reference

`#include <XrdFrcReqAgent.hh>`

Collaboration diagram for XrdFrcReqAgent:

## Public Member Functions

| XrdFrcReqAgent (const char *Me, int qVal)
| ~XrdFrcReqAgent ()
void | Add (XrdFrcRequest &Request)
void | Del (XrdFrcRequest &Request)
int | List (XrdFrcRequest::Item *Items, int Num)
int | List (XrdFrcRequest::Item *Items, int Num, int Prty)
int | NextLFN (char *Buff, int Bsz, int Prty, int &Offs)
void | Ping (const char *Msg=0)
int | Start (char *aPath, int aMode)

## Detailed Description

Definition at line 36 of file XrdFrcReqAgent.hh.

## Constructor & Destructor Documentation

## XrdFrcReqAgent()

XrdFrcReqAgent::XrdFrcReqAgent | ( | const char * | Me,
|  | int | qVal )

Definition at line 60 of file XrdFrcReqAgent.cc.

: Persona(Me),myName(""),theQ(qVal)
{
// Set default ping message
//
switch(qVal)
{case XrdFrcRequest::getQ: pingMsg = "!<\n"; break;
case XrdFrcRequest::migQ: pingMsg = "!&\n"; break;
case XrdFrcRequest::stgQ: pingMsg = "!+\n"; break;
case XrdFrcRequest::putQ: pingMsg = "!>\n"; break;
default: pingMsg = "!\n" ; break;
}
}
XrdFrcRequest::stgQ
static const int stgQ
Definition XrdFrcRequest.hh:87
XrdFrcRequest::getQ
static const int getQ
Definition XrdFrcRequest.hh:89
XrdFrcRequest::migQ
static const int migQ
Definition XrdFrcRequest.hh:88
XrdFrcRequest::putQ
static const int putQ
Definition XrdFrcRequest.hh:90

References XrdFrcRequest::getQ, XrdFrcRequest::migQ, XrdFrcRequest::putQ, and XrdFrcRequest::stgQ.

## ~XrdFrcReqAgent()

XrdFrcReqAgent::~XrdFrcReqAgent | ( |  | ) |

inline

Definition at line 54 of file XrdFrcReqAgent.hh.

{}

## Member Function Documentation

## Add()

void XrdFrcReqAgent::Add | ( | XrdFrcRequest & | Request | ) |

Definition at line 78 of file XrdFrcReqAgent.cc.

{
// Complete the request including verifying the priority
//
if (Request.Prty > XrdFrcRequest::maxPrty)
Request.Prty = XrdFrcRequest::maxPrty;
else if (Request.Prty < 0)Request.Prty = 0;
// Add time and instance name
//
Request.addTOD = time(0);
if (myName) strlcpy(Request.iName, myName, sizeof(Request.iName));
// Now add it to the queue
//
rQueue[static_cast<int>(Request.Prty)]->Add(&Request);
// Now wake the boss
//
Ping();
}
strlcpy
size_t strlcpy(char *dst, const char *src, size_t sz)
Definition XrdSysPlatform.cc:60
XrdFrcReqAgent::Ping
void Ping(const char *Msg=0)
Definition XrdFrcReqAgent.cc:172
XrdFrcReqAgent::Add
void Add(XrdFrcRequest &Request)
Definition XrdFrcReqAgent.cc:78
XrdFrcRequest::iName
char iName[32]
Definition XrdFrcRequest.hh:42
XrdFrcRequest::Prty
signed char Prty
Definition XrdFrcRequest.hh:54
XrdFrcRequest::maxPrty
static const int maxPrty
Definition XrdFrcRequest.hh:77
XrdFrcRequest::addTOD
long long addTOD
Definition XrdFrcRequest.hh:44

References Add(), XrdFrcRequest::addTOD, XrdFrcRequest::iName, XrdFrcRequest::maxPrty, Ping(), XrdFrcRequest::Prty, and strlcpy().

Referenced by Add().

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

## Del()

void XrdFrcReqAgent::Del | ( | XrdFrcRequest & | Request | ) |

Definition at line 105 of file XrdFrcReqAgent.cc.

{
int i;
// Remove all pending requests for this id
//
for (i = 0; i <= XrdFrcRequest::maxPrty; i++) rQueue[i]->Can(&Request);
}

References XrdFrcRequest::maxPrty.

## List() [1/2]

int XrdFrcReqAgent::List | ( | XrdFrcRequest::Item * | Items,
|  | int | Num )

Definition at line 118 of file XrdFrcReqAgent.cc.

{
char myLfn[8192];
int i, Offs, n = 0;
// List entries in each priority queue
//
for (i = 0; i <= XrdFrcRequest::maxPrty; i++)
{Offs = 0;
while(rQueue[i]->List(myLfn, sizeof(myLfn), Offs, Items, Num))
{std::cout <<myLfn <<std::endl; n++;}
}
// All done
//
return n;
}
XrdFrcReqAgent::List
int List(XrdFrcRequest::Item *Items, int Num)
Definition XrdFrcReqAgent.cc:118

References List(), and XrdFrcRequest::maxPrty.

Referenced by List(), and List().

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

## List() [2/2]

int XrdFrcReqAgent::List | ( | XrdFrcRequest::Item * | Items,
|  | int | Num,
|  | int | Prty )

Definition at line 137 of file XrdFrcReqAgent.cc.

{
char myLfn[8192];
int Offs, n = 0;
// List entries in each priority queue
//
if (Prty <= XrdFrcRequest::maxPrty)
{Offs = 0;
while(rQueue[Prty]->List(myLfn, sizeof(myLfn), Offs, Items, Num))
{std::cout <<myLfn <<std::endl; n++;}
}
// All done
//
return n;
}

References List(), and XrdFrcRequest::maxPrty.

Here is the call graph for this function:

## NextLFN()

int XrdFrcReqAgent::NextLFN | ( | char * | Buff,
|  | int | Bsz,
|  | int | Prty,
|  | int & | Offs )

Definition at line 159 of file XrdFrcReqAgent.cc.

{
static XrdFrcRequest::Item Items[1] = {XrdFrcRequest::getLFN};
// Return entry, if it exists
//
return rQueue[Prty]->List(Buff, Bsz, Offs, Items, 1) != 0;
}
XrdFrcRequest::Item
Item
Definition XrdFrcRequest.hh:82
XrdFrcRequest::getLFN
@ getLFN
Definition XrdFrcRequest.hh:82

References XrdFrcRequest::getLFN.

## Ping()

void XrdFrcReqAgent::Ping | ( | const char * | Msg = 0 | ) |

Definition at line 172 of file XrdFrcReqAgent.cc.

{
static XrdNetMsg udpMsg(&Say, c2sFN);
static int udpOK = 0;
struct stat buf;
// Send given message or default message based on our persona
//
if (udpOK || !stat(c2sFN, &buf))
{udpMsg.Send(Msg ? Msg : pingMsg); udpOK = 1;}
}
Say
XrdOucPup XrdCmsParser::Pup & Say
Definition XrdCmsParser.cc:124
stat
#define stat(a, b)
Definition XrdPosix.hh:101

References Say, XrdNetMsg::Send(), and stat.

Referenced by Add(), and Start().

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

## Start()

int XrdFrcReqAgent::Start | ( | char * | aPath,
|  | int | aMode )

Definition at line 188 of file XrdFrcReqAgent.cc.

{
XrdFrcRequest Request;
const char *myClid;
char buff[2048], *qPath;
int i;
// Initialize the udp path for pings, if we have not done so
//
if (!c2sFN)
{sprintf(buff, "%sxfrd.udp", aPath);
c2sFN = strdup(buff);
}
// Get the instance name
//
myName = XrdOucUtils::InstName(1);
// Generate the queue directory path
//
if (!(qPath = XrdFrcUtils::makeQDir(aPath, aMode))) return 0;
// Initialize the registration entry and register ourselves
//
if ((myClid = getenv("XRDCMSCLUSTERID")))
{int Uid = static_cast<int>(geteuid());
int Gid = static_cast<int>(getegid());
memset(&Request, 0, sizeof(Request));
strlcpy(Request.LFN, myClid, sizeof(Request.LFN));
sprintf(Request.User,"%d %d", Uid, Gid);
sprintf(Request.ID, "%d", static_cast<int>(getpid()));
strlcpy(Request.iName, myName, sizeof(Request.iName));
Request.addTOD = time(0);
Request.Options = XrdFrcRequest::Register;
Request.OPc = '@';
}
// Initialize the request queues if all went well
//
for (i = 0; i <= XrdFrcRequest::maxPrty; i++)
{sprintf(buff, "%s%sQ.%d", qPath, Persona, i);
rQueue[i] = new XrdFrcReqFile(buff, 1);
if (!rQueue[i]->Init()) return 0;
if (myClid) rQueue[i]->Add(&Request);
}
// All done
//
if (myClid) Ping();
free(qPath);
return 1;
}
XrdFrcRequest::LFN
char LFN[3072]
Definition XrdFrcRequest.hh:37
XrdFrcRequest::Options
int Options
Definition XrdFrcRequest.hh:47
XrdFrcRequest::User
char User[256]
Definition XrdFrcRequest.hh:38
XrdFrcRequest::Register
static const int Register
Definition XrdFrcRequest.hh:63
XrdFrcRequest::ID
char ID[40]
Definition XrdFrcRequest.hh:39
XrdFrcRequest::OPc
char OPc
Definition XrdFrcRequest.hh:52
XrdFrcUtils::makeQDir
static char * makeQDir(const char *Path, int Mode)
Definition XrdFrcUtils.cc:127
XrdOucUtils::InstName
static const char * InstName(int TranOpt=0)
Definition XrdOucUtils.cc:809

References XrdFrcRequest::addTOD, XrdFrcRequest::ID, XrdFrcRequest::iName, XrdOucUtils::InstName(), XrdFrcRequest::LFN, XrdFrcUtils::makeQDir(), XrdFrcRequest::maxPrty, XrdFrcRequest::OPc, XrdFrcRequest::Options, Ping(), XrdFrcRequest::Register, strlcpy(), and XrdFrcRequest::User.

Here is the call graph for this function:

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

- XrdFrcReqAgent.hh
- XrdFrcReqAgent.cc