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
47void flushEvents();
48
49int Init(XrdSysError *eObj);
50
51int Init(XrdCmsClient *trg=0);
52
53void recvEvents();
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;}
60 ~XrdOfsEvr();
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
106void eventStage();
107void sendEvent(theEvent *ep);
108
109static const int maxLife = (8*60*60); // Eight hours
110XrdSysMutex myMutex;
111XrdSysSemaphore mySem;
112XrdOucStream eventFIFO;
113XrdSysError *eDest;
114XrdCmsClient *Balancer;
115theClient *deferQ;
116int runQ;
117int msgFD;
118
120};
121#endif
static XrdSysError eDest(0,"crypto_")
int emsg(int rc, char *msg)
XrdOucEICB * evtCB
Definition XrdOfsEvr.hh:76
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
int Same(unsigned long long arg1, unsigned long long arg2)
Definition XrdOfsEvr.hh:69
unsigned long long evtCBarg
Definition XrdOfsEvr.hh:77
const char * User
Definition XrdOfsEvr.hh:73
void Work4Event(theClient *Client)
Definition XrdOfsEvr.cc:240
int Init(XrdSysError *eObj)
Definition XrdOfsEvr.cc:132
void Wait4Event(const char *path, XrdOucErrInfo *einfo)
Definition XrdOfsEvr.cc:226
void flushEvents()
Definition XrdOfsEvr.cc:89
void recvEvents()
Definition XrdOfsEvr.cc:201
const char * getErrUser()
XrdOucEICB * getErrCB()
theEvent(int rc, const char *emsg, theClient *cp=0)
Definition XrdOfsEvr.hh:94
theClient * aClient
Definition XrdOfsEvr.hh:89