xrootd
Loading...
Searching...
No Matches
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/* 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 <strings.h>
34#include "XrdOuc/XrdOucHash.hh"
38
39class XrdSysError;
40class XrdCmsClient;
41
43{
44public:
45class theClient;
46
48
49int Init(XrdSysError *eObj);
50
51int Init(XrdCmsClient *trg=0);
52
54
55void Wait4Event(const char *path, XrdOucErrInfo *einfo);
56
57void Work4Event(theClient *Client);
58
59 XrdOfsEvr() : mySem(0), eDest(0), Balancer(0) {runQ = 0; deferQ = 0;}
61
63{
64public:
65
66void Done(int &Result, XrdOucErrInfo *eInfo, const char *path=0)
67 { (void)Result; (void)eInfo; (void)path; EvrP->Work4Event(this);}
68
69int Same(unsigned long long arg1, unsigned long long arg2)
70{ (void)arg1; (void)arg2; return 0;}
71
73const char *User;
74char *Path;
77unsigned long long evtCBarg;
78
79 theClient(XrdOfsEvr *evr, XrdOucErrInfo *einfo, const char *path=0)
80 {evtCB = einfo->getErrCB(evtCBarg);
81 User = einfo->getErrUser();
82 Path = (path ? strdup(path) : 0);
83 EvrP = evr;
84 Next = 0;
85 }
86 ~theClient() {if (Path) free(Path);}
87 };
88
90 char *finalMsg;
93
94 theEvent(int rc, const char *emsg, theClient *cp=0)
95 {aClient = cp; finalRC = rc; Happened = 0;
96 finalMsg = (emsg ? strdup(emsg) : 0);
97 }
99 {if (finalMsg) free(finalMsg);
100 if (aClient) delete aClient;
101 }
102 };
103
104private:
105
108
109static const int maxLife = (8*60*60); // Eight hours
118
120};
121#endif
Definition XrdCmsClient.hh:116
Definition XrdOfsEvr.hh:63
XrdOucEICB * evtCB
Definition XrdOfsEvr.hh:76
~theClient()
Definition XrdOfsEvr.hh:86
void Done(int &Result, XrdOucErrInfo *eInfo, const char *path=0)
Definition XrdOfsEvr.hh:66
theClient(XrdOfsEvr *evr, XrdOucErrInfo *einfo, const char *path=0)
Definition XrdOfsEvr.hh:79
XrdOfsEvr * EvrP
Definition XrdOfsEvr.hh:75
int Same(unsigned long long arg1, unsigned long long arg2)
Definition XrdOfsEvr.hh:69
unsigned long long evtCBarg
Definition XrdOfsEvr.hh:77
theClient * Next
Definition XrdOfsEvr.hh:72
char * Path
Definition XrdOfsEvr.hh:74
const char * User
Definition XrdOfsEvr.hh:73
Definition XrdOfsEvr.hh:43
XrdOfsEvr()
Definition XrdOfsEvr.hh:59
int runQ
Definition XrdOfsEvr.hh:116
void Work4Event(theClient *Client)
int Init(XrdSysError *eObj)
int msgFD
Definition XrdOfsEvr.hh:117
void eventStage()
void Wait4Event(const char *path, XrdOucErrInfo *einfo)
XrdSysError * eDest
Definition XrdOfsEvr.hh:113
static const int maxLife
Definition XrdOfsEvr.hh:109
XrdSysSemaphore mySem
Definition XrdOfsEvr.hh:111
XrdCmsClient * Balancer
Definition XrdOfsEvr.hh:114
theClient * deferQ
Definition XrdOfsEvr.hh:115
XrdSysMutex myMutex
Definition XrdOfsEvr.hh:110
XrdOucStream eventFIFO
Definition XrdOfsEvr.hh:112
void flushEvents()
XrdOucHash< theEvent > Events
Definition XrdOfsEvr.hh:119
void recvEvents()
void sendEvent(theEvent *ep)
int Init(XrdCmsClient *trg=0)
Definition XrdOucErrInfo.hh:483
Definition XrdOucErrInfo.hh:101
const char * getErrUser()
Definition XrdOucErrInfo.hh:297
XrdOucEICB * getErrCB()
Definition XrdOucErrInfo.hh:224
Definition XrdOucHash.hh:128
Definition XrdOucStream.hh:47
Definition XrdSysError.hh:90
Definition XrdSysPthread.hh:165
Definition XrdSysPthread.hh:494
Definition XrdOfsEvr.hh:89
theEvent(int rc, const char *emsg, theClient *cp=0)
Definition XrdOfsEvr.hh:94
~theEvent()
Definition XrdOfsEvr.hh:98
theClient * aClient
Definition XrdOfsEvr.hh:89
int finalRC
Definition XrdOfsEvr.hh:91
char Happened
Definition XrdOfsEvr.hh:92
char * finalMsg
Definition XrdOfsEvr.hh:90