xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdBwm
XrdBwmHandle.hh
Go to the documentation of this file.
1
#ifndef __BWM_HANDLE__
2
#define __BWM_HANDLE__
3
/******************************************************************************/
4
/* */
5
/* X r d B w m H a n d l e . h h */
6
/* */
7
/* (c) 2008 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 <stdlib.h>
34
35
#include "
XrdBwm/XrdBwmPolicy.hh
"
36
#include "
XrdOuc/XrdOucErrInfo.hh
"
37
#include "
XrdSys/XrdSysPthread.hh
"
38
39
class
XrdBwmLogger
;
40
41
class
XrdBwmHandle
42
{
43
public
:
44
45
enum
HandleState
{
Idle
= 0,
Scheduled
,
Dispatched
};
46
47
HandleState
Status
;
48
49
int
Activate
(
XrdOucErrInfo
&einfo);
50
51
static
XrdBwmHandle
*
Alloc
(
const
char
*theUsr,
const
char
*thePath,
52
const
char
*lclNode,
const
char
*rmtNode,
53
int
Incomming);
54
55
static
void
*
Dispatch
();
56
57
inline
const
char
*
Name
() {
return
Parms
.
Lfn
;}
58
59
void
Retire
();
60
61
static
int
setPolicy
(
XrdBwmPolicy
*pP,
XrdBwmLogger
*lP);
62
63
XrdBwmHandle
() :
Status
(
Idle
),
Next
(0),
qTime
(0),
rTime
(0),
64
xSize
(0),
xTime
(0)
65
{}
66
67
~XrdBwmHandle
() {}
68
69
private
:
70
static
XrdBwmHandle
*
Alloc
(
XrdBwmHandle
*oldHandle=0);
71
static
XrdBwmHandle
*
refHandle
(
int
refID,
XrdBwmHandle
*hP=0);
72
73
static
XrdBwmPolicy
*
Policy
;
74
static
XrdBwmLogger
*
Logger
;
75
static
XrdBwmHandle
*
Free
;
// List of free handles
76
static
unsigned
int
numQueued
;
77
78
XrdSysMutex
hMutex
;
79
XrdBwmPolicy::SchedParms
Parms
;
80
XrdBwmHandle
*
Next
;
81
XrdOucEICB
*
ErrCB
;
82
unsigned
long
long
ErrCBarg
;
83
time_t
qTime
;
84
time_t
rTime
;
85
long
long
xSize
;
86
long
xTime
;
87
int
rHandle
;
88
89
class
theEICB
:
public
XrdOucEICB
90
{
91
public
:
92
93
void
Done
(
int
&Result,
XrdOucErrInfo
*eInfo,
const
char
*
Path
=0)
94
{
mySem
.
Post
();}
95
96
int
Same
(
unsigned
long
long
arg1,
unsigned
long
long
arg2)
97
{
return
arg1 == arg2;}
98
99
void
Wait
() {
mySem
.
Wait
();}
100
101
theEICB
() :
mySem
(0) {}
102
103
virtual
~theEICB
() {}
104
105
private
:
106
XrdSysSemaphore
mySem
;
107
}
myEICB
;
108
};
109
#endif
Generated by
1.8.3.1