XRootD
Loading...
Searching...
No Matches
XrdFrcProxy Class Reference

#include <XrdFrcProxy.hh>

+ Collaboration diagram for XrdFrcProxy:

Classes

class  Queues
 

Public Member Functions

 XrdFrcProxy (XrdSysLogger *lP, const char *iName, int Debug=0)
 
 ~XrdFrcProxy ()
 
int Add (char Opc, const char *Lfn, const char *Opq, const char *Usr, const char *Rid, const char *Nop, const char *Pop, int Prty=1)
 
int Del (char Opc, const char *Rid)
 
int Init (int opX, const char *aPath, int aMode, const char *qPath=0)
 
int List (int qType, int qPrty, XrdFrcRequest::Item *Items, int Num)
 
int List (Queues &State, char *Buff, int Bsz)
 

Static Public Attributes

static const int opAll = 15
 
static const int opGet = 1
 
static const int opMig = 4
 
static const int opPut = 2
 
static const int opStg = 8
 

Detailed Description

Definition at line 39 of file XrdFrcProxy.hh.

Constructor & Destructor Documentation

◆ XrdFrcProxy()

XrdFrcProxy::XrdFrcProxy ( XrdSysLogger * lP,
const char * iName,
int Debug = 0 )

Definition at line 67 of file XrdFrcProxy.cc.

68{
69 char buff[256];
70
71// Clear agent vector
72//
73 memset(Agent, 0, sizeof(Agent));
74
75// Link the logger to our message facility
76//
77 Say.logger(lP);
78
79// Set the debug flag
80//
81 if (Debug) Trace.What |= TRACE_ALL;
82
83// Develop our internal name
84//
85 QPath = 0;
86 insName = XrdOucUtils::InstName(iName,0);
87 sprintf(buff,"%s.%d",XrdOucUtils::InstName(iName),static_cast<int>(getpid()));
88 intName = strdup(buff);
89}
XrdOucPup XrdCmsParser::Pup & Say
bool Debug
#define TRACE_ALL
Definition XrdTrace.hh:35
static const char * InstName(int TranOpt=0)
XrdOucTrace Trace

References Debug, XrdOucUtils::InstName(), Say, XrdFrc::Trace, and TRACE_ALL.

+ Here is the call graph for this function:

◆ ~XrdFrcProxy()

XrdFrcProxy::~XrdFrcProxy ( )
inline

Definition at line 74 of file XrdFrcProxy.hh.

74{}

Member Function Documentation

◆ Add()

int XrdFrcProxy::Add ( char Opc,
const char * Lfn,
const char * Opq,
const char * Usr,
const char * Rid,
const char * Nop,
const char * Pop,
int Prty = 1 )

Definition at line 95 of file XrdFrcProxy.cc.

98{
99 XrdFrcRequest myReq;
100 int n, Options = 0;
101 int qType = XrdFrcUtils::MapR2Q(Opc, &Options);
102
103// Verify that we can support this operation
104//
105 if (!Agent[qType]) return -ENOTSUP;
106
107// Initialize the request element
108//
109 memset(&myReq, 0, sizeof(myReq));
110 myReq.OPc = Opc;
111
112// Insert the Lfn and Opaque information
113//
114 n = strlen(Lfn);
115 if (Opq && *Opq)
116 {if (n + strlen(Opq) + 2 > sizeof(myReq.LFN)) return -ENAMETOOLONG;
117 strcpy(myReq.LFN, Lfn); strcpy(myReq.LFN+n+1, Opq), myReq.Opaque = n+1;
118 } else if (n < int(sizeof(myReq.LFN))) strcpy(myReq.LFN, Lfn);
119 else return -ENAMETOOLONG;
120
121// Get the LFN offset in case this is a url
122//
123 if (myReq.LFN[0] != '/' && !(myReq.LFO = XrdFrcUtils::chkURL(myReq.LFN)))
124 return -EILSEQ;
125
126// Set the user, request id, notification path, and priority
127//
128 if (Usr && *Usr) strlcpy(myReq.User, Usr, sizeof(myReq.User));
129 else strcpy(myReq.User, intName);
130 if (Rid) strlcpy(myReq.ID, Rid, sizeof(myReq.ID));
131 else *(myReq.ID) = '?';
132 if (Nop && *Nop) strlcpy(myReq.Notify, Nop, sizeof(myReq.Notify));
133 else *(myReq.Notify) = '-';
134 myReq.Prty = Prty;
135
136// Establish processing options
137//
138 myReq.Options = Options | XrdFrcUtils::MapM2O(myReq.Notify, Pop);
139
140// Add this request to the queue of requests via the agent
141//
142 Agent[qType]->Add(myReq);
143 return 0;
144}
size_t strlcpy(char *dst, const char *src, size_t sz)
char LFN[3072]
signed char Prty
char Notify[512]
static int chkURL(const char *Url)
static int MapR2Q(char Opc, int *Flags=0)
static int MapM2O(const char *Nop, const char *Pop)

References XrdFrcUtils::chkURL(), XrdFrcRequest::ID, XrdFrcRequest::LFN, XrdFrcRequest::LFO, XrdFrcUtils::MapM2O(), XrdFrcUtils::MapR2Q(), XrdFrcRequest::Notify, XrdFrcRequest::Opaque, XrdFrcRequest::OPc, XrdFrcRequest::Options, XrdFrcRequest::Prty, strlcpy(), and XrdFrcRequest::User.

+ Here is the call graph for this function:

◆ Del()

int XrdFrcProxy::Del ( char Opc,
const char * Rid )

Definition at line 150 of file XrdFrcProxy.cc.

151{
152 XrdFrcRequest myReq;
153 int qType = XrdFrcUtils::MapR2Q(Opc);
154
155// Verify that we can support this operation
156//
157 if (!Agent[qType]) return -ENOTSUP;
158
159// Initialize the request element
160//
161 memset(&myReq, 0, sizeof(myReq));
162 strlcpy(myReq.ID, Rid, sizeof(myReq.ID));
163
164// Delete the request from the queue
165//
166 Agent[qType]->Del(myReq);
167 return 0;
168}

References XrdFrcRequest::ID, XrdFrcUtils::MapR2Q(), and strlcpy().

+ Here is the call graph for this function:

◆ Init()

int XrdFrcProxy::Init ( int opX,
const char * aPath,
int aMode,
const char * qPath = 0 )

Definition at line 229 of file XrdFrcProxy.cc.

230{
231 const char *configFN = getenv("XRDCONFIGFN"), *iName = 0;
232 int i;
233
234// If a qPath was specified, and the "Queues" component will be added later.
235// Otherwise, we check the config file to see if there is a qpath there.
236// If not we use the aPath which must be unqualified with a component name
237// which we will add here). All paths must have the instance name if so needed.
238//
239 if (qPath) QPath = strdup(qPath);
240 else if (!configFN) iName = insName;
241 else if (Init2(configFN)) return 0;
242
243// Create the queue path directory if it does not exists
244//
245 if (!QPath && !(QPath = XrdFrcUtils::makePath(iName, aPath, aMode)))
246 return 0;
247
248// Now create and start an agent for each wanted service
249//
250 for (i = 0; i < oqNum; i++)
251 if (opX & oqMap[i].oType)
252 {Agent[oqMap[i].qType]
253 = new XrdFrcReqAgent(oqMap[i].qName, oqMap[i].qType);
254 if (!Agent[oqMap[i].qType]->Start(QPath, aMode)) return 0;
255 }
256
257// All done
258//
259 return 1;
260}
static char * makePath(const char *iName, const char *Path, int Mode)

References XrdFrcUtils::makePath().

+ Here is the call graph for this function:

◆ List() [1/2]

int XrdFrcProxy::List ( int qType,
int qPrty,
XrdFrcRequest::Item * Items,
int Num )

Definition at line 205 of file XrdFrcProxy.cc.

206{
207 int i, n, Cnt = 0;
208
209// List each queue
210//
211 while(qType & opAll)
212 {for (i = 0; i < oqNum; i++) if (oqMap[i].oType & qType) break;
213 if (i >= oqNum) return Cnt;
214 qType &= ~oqMap[i].oType; n = oqMap[i].qType;
215 if (!Agent[n]) continue;
216 if (qPrty < 0) Cnt += Agent[n]->List(Items, Num);
217 else Cnt += Agent[n]->List(Items, Num, qPrty);
218 }
219
220// All done
221//
222 return Cnt;
223}
static const int opAll

References opAll.

◆ List() [2/2]

int XrdFrcProxy::List ( XrdFrcProxy::Queues & State,
char * Buff,
int Bsz )

Definition at line 174 of file XrdFrcProxy.cc.

175{
176 int i;
177
178// Get a queue type
179//
180do{if (!State.Active)
181 while(State.QList & opAll)
182 {for (i = 0; i < oqNum; i++) if (oqMap[i].oType & State.QList) break;
183 if (i >= oqNum) return 0;
184 State.QNow = oqMap[i].qType;
185 State.QList &= ~oqMap[i].oType;
186 if (!Agent[int(State.QNow)]) continue;
187 State.Active = 1;
188 break;
189 }
190
191 for (i = State.Prty; i <= XrdFrcRequest::maxPrty; i++)
192 if (Agent[int(State.QNow)]->NextLFN(Buff,Bsz,i,State.Offset)) return 1;
193 else State.Prty = i+1;
194
195 State.Active = 0; State.Offset = 0; State.Prty = 0;
196 } while(State.QList & opAll);
197
198// We've completed returning all info
199//
200 return 0;
201}
static const int maxPrty

References XrdFrcRequest::maxPrty, and opAll.

Member Data Documentation

◆ opAll

const int XrdFrcProxy::opAll = 15
static

Definition at line 53 of file XrdFrcProxy.hh.

Referenced by List(), and List().

◆ opGet

const int XrdFrcProxy::opGet = 1
static

Definition at line 49 of file XrdFrcProxy.hh.

◆ opMig

const int XrdFrcProxy::opMig = 4
static

Definition at line 51 of file XrdFrcProxy.hh.

◆ opPut

const int XrdFrcProxy::opPut = 2
static

Definition at line 50 of file XrdFrcProxy.hh.

◆ opStg

const int XrdFrcProxy::opStg = 8
static

Definition at line 52 of file XrdFrcProxy.hh.

Referenced by XrdOssSys::ConfigStage(), and XrdCmsPrepare::Reset().


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