xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdOfs
XrdOfsEvr.hh
Go to the documentation of this file.
1
#ifndef __XRDOFSEVR_H__
2
#define __XRDOFSEVR_H__
3
/******************************************************************************/
4
/* */
5
/* X r d O f s E v r . h h */
6
/* */
7
/* (c) 2006 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 <strings.h>
14
#include "
XrdOuc/XrdOucHash.hh
"
15
#include "
XrdOuc/XrdOucErrInfo.hh
"
16
#include "
XrdSys/XrdSysPthread.hh
"
17
#include "
XrdOuc/XrdOucStream.hh
"
18
19
class
XrdSysError
;
20
class
XrdCmsClient
;
21
22
class
XrdOfsEvr
23
{
24
public
:
25
class
theClient
;
26
27
void
flushEvents
();
28
29
int
Init
(
XrdSysError
*eObj);
30
31
int
Init
(
XrdCmsClient
*trg=0);
32
33
void
recvEvents
();
34
35
void
Wait4Event
(
const
char
*path,
XrdOucErrInfo
*einfo);
36
37
void
Work4Event
(
theClient
*Client);
38
39
XrdOfsEvr
() :
mySem
(0) {
runQ
= 0;
deferQ
= 0;}
40
~XrdOfsEvr
();
41
42
class
theClient
:
XrdOucEICB
43
{
44
public
:
45
46
void
Done
(
int
&Result,
XrdOucErrInfo
*eInfo,
const
char
*path=0)
47
{
EvrP
->
Work4Event
(
this
);}
48
49
int
Same
(
unsigned
long
long
arg1,
unsigned
long
long
arg2) {
return
0;}
50
51
theClient
*
Next
;
52
const
char
*
User
;
53
char
*
Path
;
54
XrdOfsEvr
*
EvrP
;
55
XrdOucEICB
*
evtCB
;
56
unsigned
long
long
evtCBarg
;
57
58
theClient
(
XrdOfsEvr
*evr,
XrdOucErrInfo
*einfo,
const
char
*path=0)
59
{
evtCB
= einfo->
getErrCB
(
evtCBarg
);
60
User
= einfo->
getErrUser
();
61
Path
= (path ? strdup(path) : 0);
62
EvrP
= evr;
63
Next
= 0;
64
}
65
~theClient
() {
if
(
Path
) free(
Path
);}
66
};
67
68
struct
theEvent
{
theClient
*
aClient
;
69
char
*
finalMsg
;
70
int
finalRC
;
71
char
Happened
;
72
73
theEvent
(
int
rc,
const
char
*
emsg
,
theClient
*cp=0)
74
{
aClient
= cp;
finalRC
= rc;
Happened
= 0;
75
finalMsg
= (emsg ? strdup(emsg) : 0);
76
}
77
~theEvent
()
78
{
if
(
finalMsg
) free(
finalMsg
);
79
if
(
aClient
)
delete
aClient
;
80
}
81
};
82
83
private
:
84
85
void
eventStage
();
86
void
sendEvent
(theEvent *ep);
87
88
static
const
int
maxLife
= (8*60*60);
// Eight hours
89
XrdSysMutex
myMutex
;
90
XrdSysSemaphore
mySem
;
91
XrdOucStream
eventFIFO
;
92
XrdSysError
*
eDest
;
93
XrdCmsClient
*
Balancer
;
94
theClient
*
deferQ
;
95
int
runQ
;
96
int
msgFD
;
97
98
XrdOucHash<theEvent>
Events
;
99
};
100
#endif
Generated by
1.8.1.2