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
13
#include <stdlib.h>
14
15
#include "
XrdBwm/XrdBwmPolicy.hh
"
16
#include "
XrdOuc/XrdOucErrInfo.hh
"
17
#include "
XrdSys/XrdSysPthread.hh
"
18
19
class
XrdBwmLogger
;
20
21
class
XrdBwmHandle
22
{
23
public
:
24
25
enum
HandleState
{
Idle
= 0,
Scheduled
,
Dispatched
};
26
27
HandleState
Status
;
28
29
int
Activate
(
XrdOucErrInfo
&einfo);
30
31
static
XrdBwmHandle
*
Alloc
(
const
char
*theUsr,
const
char
*thePath,
32
const
char
*lclNode,
const
char
*rmtNode,
33
int
Incomming);
34
35
static
void
*
Dispatch
();
36
37
inline
const
char
*
Name
() {
return
Parms
.
Lfn
;}
38
39
void
Retire
();
40
41
static
int
setPolicy
(
XrdBwmPolicy
*pP,
XrdBwmLogger
*lP);
42
43
XrdBwmHandle
() :
Status
(
Idle
),
Next
(0),
qTime
(0),
rTime
(0),
44
xSize
(0),
xTime
(0)
45
{}
46
47
~XrdBwmHandle
() {}
48
49
private
:
50
static
XrdBwmHandle
*
Alloc
(
XrdBwmHandle
*oldHandle=0);
51
static
XrdBwmHandle
*
refHandle
(
int
refID,
XrdBwmHandle
*hP=0);
52
53
static
XrdBwmPolicy
*
Policy
;
54
static
XrdBwmLogger
*
Logger
;
55
static
XrdBwmHandle
*
Free
;
// List of free handles
56
static
unsigned
int
numQueued
;
57
58
XrdSysMutex
hMutex
;
59
XrdBwmPolicy::SchedParms
Parms
;
60
XrdBwmHandle
*
Next
;
61
XrdOucEICB
*
ErrCB
;
62
unsigned
long
long
ErrCBarg
;
63
time_t
qTime
;
64
time_t
rTime
;
65
long
long
xSize
;
66
long
xTime
;
67
int
rHandle
;
68
69
class
theEICB
:
public
XrdOucEICB
70
{
71
public
:
72
73
void
Done
(
int
&Result,
XrdOucErrInfo
*eInfo,
const
char
*
Path
=0)
74
{
mySem
.
Post
();}
75
76
int
Same
(
unsigned
long
long
arg1,
unsigned
long
long
arg2)
77
{
return
arg1 == arg2;}
78
79
void
Wait
() {
mySem
.
Wait
();}
80
81
theEICB
() :
mySem
(0) {}
82
83
virtual
~theEICB
() {}
84
85
private
:
86
XrdSysSemaphore
mySem
;
87
}
myEICB
;
88
};
89
#endif
Generated by
1.8.1.2