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
"
36
#include "
XProtocol/YProtocol.hh
"
37
38
#include "
XrdCms/XrdCmsTypes.hh
"
39
#include "
XrdOuc/XrdOucDLlist.hh
"
40
#include "
XrdSys/XrdSysPthread.hh
"
41
42
/******************************************************************************/
43
/* X r d C m s R R Q I n f o */
44
/******************************************************************************/
45
46
class
XrdCmsRRQInfo
47
{
48
public
:
49
void
*
Key
;
// Key link, which is the cache line address
50
kXR_unt32
ID
;
// Response link, which is the request ID
51
int
Rinst
;
// Redirector instance
52
short
Rnum
;
// Redirector number (RTable slot number)
53
char
isRW
;
// True if r/w access wanted
54
char
isLU
;
// True if locate response wanted
55
char
minR
;
// Minimum number of responses for fast redispatch
56
char
actR
;
// Actual number of responses
57
char
lsLU
;
// Lookup options
58
char
ifOP
;
// XrdNetIF::ifType to return (cast as char)
59
SMask_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) {}
66
~XrdCmsRRQInfo
() {}
67
};
68
69
/******************************************************************************/
70
/* X r d C m s R R Q S l o t */
71
/******************************************************************************/
72
73
class
XrdCmsRRQSlot
74
{
75
friend
class
XrdCmsRRQ
;
76
77
static
XrdCmsRRQSlot
*Alloc(
XrdCmsRRQInfo
*Info);
78
79
void
Recycle();
80
81
XrdCmsRRQSlot
();
82
~XrdCmsRRQSlot
() {}
83
84
private
:
85
86
static
XrdSysMutex
myMutex;
87
static
XrdCmsRRQSlot
*freeSlot;
88
static
short
initSlot;
89
90
XrdOucDLlist<XrdCmsRRQSlot>
Link;
91
XrdCmsRRQSlot
*Cont;
92
XrdCmsRRQSlot
*LkUp;
93
XrdCmsRRQInfo
Info;
94
SMask_t
Arg1;
95
SMask_t
Arg2;
96
unsigned
int
Expire;
97
int
slotNum;
98
};
99
100
/******************************************************************************/
101
/* X r d C m s R R Q */
102
/******************************************************************************/
103
104
class
XrdCmsRRQ
105
{
106
public
:
107
108
short
Add
(
short
Snum,
XrdCmsRRQInfo
*ip);
109
110
void
Del
(
short
Snum,
const
void
*Key);
111
112
int
Init
(
int
Tint=0,
int
Tdly=0);
113
114
int
Ready
(
int
Snum,
const
void
*Key,
SMask_t
mask1,
SMask_t
mask2);
115
116
void
*
Respond
();
117
118
struct
Info
119
{
120
Info
()
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
144
void
Statistics
(
Info
&Data) {myMutex.
Lock
(); Data = Stats; myMutex.
UnLock
();}
145
146
void
*
TimeOut
();
147
148
XrdCmsRRQ
() : isWaiting(0), isReady(0),
149
luFast(0), luSlow(0), rdFast(0), rdSlow(0),
150
Tslice(178), Tdelay(5), myClock(0) {}
151
~XrdCmsRRQ
() {}
152
153
private
:
154
155
void
sendLocResp(
XrdCmsRRQSlot
*lP);
156
void
sendLwtResp(
XrdCmsRRQSlot
*rP);
157
void
sendRedResp(
XrdCmsRRQSlot
*rP);
158
static
const
int
numSlots = 1024;
159
160
XrdSysMutex
myMutex;
161
XrdSysSemaphore
isWaiting;
162
XrdSysSemaphore
isReady;
163
XrdCmsRRQSlot
Slot[numSlots];
164
XrdOucDLlist<XrdCmsRRQSlot>
waitQ;
165
XrdOucDLlist<XrdCmsRRQSlot>
readyQ;
// Redirect/Locate ready queue
166
static
const
int
iov_cnt = 2;
167
struct
iovec data_iov[iov_cnt];
168
struct
iovec redr_iov[iov_cnt];
169
XrdCms::CmsResponse
dataResp;
170
XrdCms::CmsResponse
redrResp;
171
XrdCms::CmsResponse
waitResp;
172
union
{
char
hostbuff[288];
173
char
databuff[
XrdCms::CmsLocateRequest::RHLen
174
*
STMax
];
175
};
176
Info
Stats;
177
int
luFast;
178
int
luSlow;
179
int
rdFast;
180
int
rdSlow;
181
int
Tslice;
182
int
Tdelay;
183
unsigned
int
myClock;
184
};
185
186
namespace
XrdCms
187
{
188
extern
XrdCmsRRQ
RRQ
;
189
}
190
#endif
XPtypes.hh
kXR_unt32
unsigned int kXR_unt32
Definition
XPtypes.hh:90
XrdCmsTypes.hh
STMax
#define STMax
Definition
XrdCmsTypes.hh:39
SMask_t
unsigned long long SMask_t
Definition
XrdCmsTypes.hh:33
XrdOucDLlist.hh
XrdSysPthread.hh
YProtocol.hh
XrdCmsRRQInfo
Definition
XrdCmsRRQ.hh:47
XrdCmsRRQInfo::actR
char actR
Definition
XrdCmsRRQ.hh:56
XrdCmsRRQInfo::~XrdCmsRRQInfo
~XrdCmsRRQInfo()
Definition
XrdCmsRRQ.hh:66
XrdCmsRRQInfo::minR
char minR
Definition
XrdCmsRRQ.hh:55
XrdCmsRRQInfo::XrdCmsRRQInfo
XrdCmsRRQInfo()
Definition
XrdCmsRRQ.hh:61
XrdCmsRRQInfo::Key
void * Key
Definition
XrdCmsRRQ.hh:49
XrdCmsRRQInfo::rwVec
SMask_t rwVec
Definition
XrdCmsRRQ.hh:59
XrdCmsRRQInfo::Rnum
short Rnum
Definition
XrdCmsRRQ.hh:52
XrdCmsRRQInfo::lsLU
char lsLU
Definition
XrdCmsRRQ.hh:57
XrdCmsRRQInfo::XrdCmsRRQInfo
XrdCmsRRQInfo(int rinst, short rnum, kXR_unt32 id, int minQ=0)
Definition
XrdCmsRRQ.hh:62
XrdCmsRRQInfo::isRW
char isRW
Definition
XrdCmsRRQ.hh:53
XrdCmsRRQInfo::Rinst
int Rinst
Definition
XrdCmsRRQ.hh:51
XrdCmsRRQInfo::isLU
char isLU
Definition
XrdCmsRRQ.hh:54
XrdCmsRRQInfo::ID
kXR_unt32 ID
Definition
XrdCmsRRQ.hh:50
XrdCmsRRQInfo::ifOP
char ifOP
Definition
XrdCmsRRQ.hh:58
XrdCmsRRQSlot
Definition
XrdCmsRRQ.hh:74
XrdCmsRRQ
Definition
XrdCmsRRQ.hh:105
XrdCmsRRQ::Init
int Init(int Tint=0, int Tdly=0)
Definition
XrdCmsRRQ.cc:125
XrdCmsRRQ::Statistics
void Statistics(Info &Data)
Definition
XrdCmsRRQ.hh:144
XrdCmsRRQ::XrdCmsRRQ
XrdCmsRRQ()
Definition
XrdCmsRRQ.hh:148
XrdCmsRRQ::TimeOut
void * TimeOut()
Definition
XrdCmsRRQ.cc:398
XrdCmsRRQ::Respond
void * Respond()
Definition
XrdCmsRRQ.cc:241
XrdCmsRRQ::~XrdCmsRRQ
~XrdCmsRRQ()
Definition
XrdCmsRRQ.hh:151
XrdCmsRRQ::Add
short Add(short Snum, XrdCmsRRQInfo *ip)
Definition
XrdCmsRRQ.cc:76
XrdCmsRRQ::Del
void Del(short Snum, const void *Key)
Definition
XrdCmsRRQ.cc:116
XrdCmsRRQ::Ready
int Ready(int Snum, const void *Key, SMask_t mask1, SMask_t mask2)
Definition
XrdCmsRRQ.cc:197
XrdOucDLlist
Definition
XrdOucDLlist.hh:36
XrdSysMutex
Definition
XrdSysPthread.hh:165
XrdSysMutex::Lock
void Lock()
Definition
XrdSysPthread.hh:222
XrdSysMutex::UnLock
void UnLock()
Definition
XrdSysPthread.hh:224
XrdSysSemaphore
Definition
XrdSysPthread.hh:494
Macaroons::Info
@ Info
Definition
XrdMacaroonsHandler.hh:18
XrdCms
Definition
YProtocol.hh:78
XrdCms::RRQ
XrdCmsRRQ RRQ
Definition
XrdCmsRRQ.cc:55
XrdCmsRRQ::Info
Definition
XrdCmsRRQ.hh:119
XrdCmsRRQ::Info::luSlow
long long luSlow
Definition
XrdCmsRRQ.hh:139
XrdCmsRRQ::Info::rdSlow
long long rdSlow
Definition
XrdCmsRRQ.hh:141
XrdCmsRRQ::Info::Resp
long long Resp
Definition
XrdCmsRRQ.hh:136
XrdCmsRRQ::Info::Reset
void Reset()
Definition
XrdCmsRRQ.hh:123
XrdCmsRRQ::Info::luFast
long long luFast
Definition
XrdCmsRRQ.hh:138
XrdCmsRRQ::Info::Add2Q
long long Add2Q
Definition
XrdCmsRRQ.hh:134
XrdCmsRRQ::Info::Multi
long long Multi
Definition
XrdCmsRRQ.hh:137
XrdCmsRRQ::Info::rdFast
long long rdFast
Definition
XrdCmsRRQ.hh:140
XrdCmsRRQ::Info::Info
Info()
Definition
XrdCmsRRQ.hh:120
XrdCmsRRQ::Info::PBack
long long PBack
Definition
XrdCmsRRQ.hh:135
XrdCms::CmsLocateRequest::RHLen
static const int RHLen
Definition
YProtocol.hh:264
XrdCms::CmsResponse
Definition
YProtocol.hh:168
XrdCms
XrdCmsRRQ.hh
Generated by
1.12.0