xrootd
Loading...
Searching...
No Matches
XrdCmsRRQ.hh
Go to the documentation of this file.
1#ifndef __XRDCMSRRQ_HH__
2#define __XRDCMSRRQ_HH__
3/******************************************************************************/
4/* */
5/* X r d C m s R R Q . 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 <sys/uio.h>
34
35#include "XProtocol/XPtypes.hh"
37
38#include "XrdCms/XrdCmsTypes.hh"
41
42/******************************************************************************/
43/* X r d C m s R R Q I n f o */
44/******************************************************************************/
45
47{
48public:
49void *Key; // Key link, which is the cache line address
50kXR_unt32 ID; // Response link, which is the request ID
51int Rinst; // Redirector instance
52short Rnum; // Redirector number (RTable slot number)
53char isRW; // True if r/w access wanted
54char isLU; // True if locate response wanted
55char minR; // Minimum number of responses for fast redispatch
56char actR; // Actual number of responses
57char lsLU; // Lookup options
58char ifOP; // XrdNetIF::ifType to return (cast as char)
59SMask_t rwVec; // R/W servers for corresponding path (if isLU is true)
60
61 XrdCmsRRQInfo() : isLU(0), ifOP(0) {}
62 XrdCmsRRQInfo(int rinst, short rnum, kXR_unt32 id, int minQ=0)
63 : Key(0), ID(id), Rinst(rinst), Rnum(rnum),
64 isRW(0), isLU(0), minR(minQ), actR(0), lsLU(0), ifOP(0),
65 rwVec(0) {}
67};
68
69/******************************************************************************/
70/* X r d C m s R R Q S l o t */
71/******************************************************************************/
72
99
100/******************************************************************************/
101/* X r d C m s R R Q */
102/******************************************************************************/
103
105{
106public:
107
108short Add(short Snum, XrdCmsRRQInfo *ip);
109
110void Del(short Snum, const void *Key);
111
112int Init(int Tint=0, int Tdly=0);
113
114int Ready(int Snum, const void *Key, SMask_t mask1, SMask_t mask2);
115
116void *Respond();
117
118struct Info
119 {
121 {Reset();}
122
123 void Reset()
124 {Add2Q = 0;
125 PBack = 0;
126 Resp = 0;
127 Multi = 0;
128 luFast = 0;
129 luSlow = 0;
130 rdFast = 0;
131 rdSlow = 0;
132 }
133
134 long long Add2Q; // Number added to queue
135 long long PBack; // Number that we could piggy-back
136 long long Resp; // Number of reponses for a waiting request
137 long long Multi; // Number of multiple response fielded
138 long long luFast; // Fast lookups
139 long long luSlow; // Slow lookups
140 long long rdFast; // Fast redirects
141 long long rdSlow; // Slow redirects
142 };
143
144void Statistics(Info &Data) {myMutex.Lock(); Data = Stats; myMutex.UnLock();}
145
146void *TimeOut();
147
149 luFast(0), luSlow(0), rdFast(0), rdSlow(0),
150 Tslice(178), Tdelay(5), myClock(0) {}
152
153private:
154
158static const int numSlots = 1024;
159
165 XrdOucDLlist<XrdCmsRRQSlot> readyQ; // Redirect/Locate ready queue
166static const int iov_cnt = 2;
167 struct iovec data_iov[iov_cnt];
168 struct iovec redr_iov[iov_cnt];
172union {char hostbuff[288];
174 *STMax];
175 };
183unsigned int myClock;
184};
185
186namespace XrdCms
187{
188extern XrdCmsRRQ RRQ;
189}
190#endif
unsigned int kXR_unt32
Definition XPtypes.hh:90
#define STMax
Definition XrdCmsTypes.hh:39
unsigned long long SMask_t
Definition XrdCmsTypes.hh:33
Definition XrdCmsRRQ.hh:47
char actR
Definition XrdCmsRRQ.hh:56
~XrdCmsRRQInfo()
Definition XrdCmsRRQ.hh:66
char minR
Definition XrdCmsRRQ.hh:55
XrdCmsRRQInfo()
Definition XrdCmsRRQ.hh:61
void * Key
Definition XrdCmsRRQ.hh:49
SMask_t rwVec
Definition XrdCmsRRQ.hh:59
short Rnum
Definition XrdCmsRRQ.hh:52
char lsLU
Definition XrdCmsRRQ.hh:57
XrdCmsRRQInfo(int rinst, short rnum, kXR_unt32 id, int minQ=0)
Definition XrdCmsRRQ.hh:62
char isRW
Definition XrdCmsRRQ.hh:53
int Rinst
Definition XrdCmsRRQ.hh:51
char isLU
Definition XrdCmsRRQ.hh:54
kXR_unt32 ID
Definition XrdCmsRRQ.hh:50
char ifOP
Definition XrdCmsRRQ.hh:58
Definition XrdCmsRRQ.hh:74
unsigned int Expire
Definition XrdCmsRRQ.hh:96
SMask_t Arg2
Definition XrdCmsRRQ.hh:95
static XrdSysMutex myMutex
Definition XrdCmsRRQ.hh:86
XrdCmsRRQSlot * LkUp
Definition XrdCmsRRQ.hh:92
~XrdCmsRRQSlot()
Definition XrdCmsRRQ.hh:82
int slotNum
Definition XrdCmsRRQ.hh:97
static XrdCmsRRQSlot * Alloc(XrdCmsRRQInfo *Info)
static XrdCmsRRQSlot * freeSlot
Definition XrdCmsRRQ.hh:87
XrdCmsRRQInfo Info
Definition XrdCmsRRQ.hh:93
XrdOucDLlist< XrdCmsRRQSlot > Link
Definition XrdCmsRRQ.hh:90
XrdCmsRRQSlot * Cont
Definition XrdCmsRRQ.hh:91
static short initSlot
Definition XrdCmsRRQ.hh:88
SMask_t Arg1
Definition XrdCmsRRQ.hh:94
Definition XrdCmsRRQ.hh:105
void sendRedResp(XrdCmsRRQSlot *rP)
int Init(int Tint=0, int Tdly=0)
int rdFast
Definition XrdCmsRRQ.hh:179
XrdCms::CmsResponse waitResp
Definition XrdCmsRRQ.hh:171
void Statistics(Info &Data)
Definition XrdCmsRRQ.hh:144
int rdSlow
Definition XrdCmsRRQ.hh:180
XrdCmsRRQ()
Definition XrdCmsRRQ.hh:148
XrdCms::CmsResponse redrResp
Definition XrdCmsRRQ.hh:170
static const int iov_cnt
Definition XrdCmsRRQ.hh:166
int luFast
Definition XrdCmsRRQ.hh:177
XrdSysSemaphore isReady
Definition XrdCmsRRQ.hh:162
void * TimeOut()
XrdOucDLlist< XrdCmsRRQSlot > readyQ
Definition XrdCmsRRQ.hh:165
void * Respond()
struct iovec redr_iov[iov_cnt]
Definition XrdCmsRRQ.hh:168
~XrdCmsRRQ()
Definition XrdCmsRRQ.hh:151
int Tslice
Definition XrdCmsRRQ.hh:181
XrdSysMutex myMutex
Definition XrdCmsRRQ.hh:160
Info Stats
Definition XrdCmsRRQ.hh:176
short Add(short Snum, XrdCmsRRQInfo *ip)
void sendLwtResp(XrdCmsRRQSlot *rP)
int Tdelay
Definition XrdCmsRRQ.hh:182
void sendLocResp(XrdCmsRRQSlot *lP)
static const int numSlots
Definition XrdCmsRRQ.hh:158
unsigned int myClock
Definition XrdCmsRRQ.hh:183
struct iovec data_iov[iov_cnt]
Definition XrdCmsRRQ.hh:167
void Del(short Snum, const void *Key)
XrdOucDLlist< XrdCmsRRQSlot > waitQ
Definition XrdCmsRRQ.hh:164
XrdSysSemaphore isWaiting
Definition XrdCmsRRQ.hh:161
int Ready(int Snum, const void *Key, SMask_t mask1, SMask_t mask2)
XrdCms::CmsResponse dataResp
Definition XrdCmsRRQ.hh:169
int luSlow
Definition XrdCmsRRQ.hh:178
XrdCmsRRQSlot Slot[numSlots]
Definition XrdCmsRRQ.hh:163
Definition XrdOucDLlist.hh:36
Definition XrdSysPthread.hh:165
void Lock()
Definition XrdSysPthread.hh:222
void UnLock()
Definition XrdSysPthread.hh:224
Definition XrdSysPthread.hh:494
Definition YProtocol.hh:78
XrdCmsRRQ RRQ
Definition XrdCmsRRQ.hh:119
long long luSlow
Definition XrdCmsRRQ.hh:139
long long rdSlow
Definition XrdCmsRRQ.hh:141
long long Resp
Definition XrdCmsRRQ.hh:136
void Reset()
Definition XrdCmsRRQ.hh:123
long long luFast
Definition XrdCmsRRQ.hh:138
long long Add2Q
Definition XrdCmsRRQ.hh:134
long long Multi
Definition XrdCmsRRQ.hh:137
long long rdFast
Definition XrdCmsRRQ.hh:140
Info()
Definition XrdCmsRRQ.hh:120
long long PBack
Definition XrdCmsRRQ.hh:135
static const int RHLen
Definition YProtocol.hh:264
Definition YProtocol.hh:168