xrootd
Loading...
Searching...
No Matches
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 <cstdlib>
34
38
39class XrdBwmLogger;
40
42{
43public:
44
46
48
50
51static XrdBwmHandle *Alloc(const char *theUsr, const char *thePath,
52 const char *lclNode, const char *rmtNode,
53 int Incoming);
54
55static void *Dispatch();
56
57inline const char *Name() {return Parms.Lfn;}
58
59 void Retire();
60
61static int setPolicy(XrdBwmPolicy *pP, XrdBwmLogger *lP);
62
64 xSize(0), xTime(0)
65 {}
66
68
69private:
70static XrdBwmHandle *Alloc(XrdBwmHandle *oldHandle=0);
71static XrdBwmHandle *refHandle(int refID, XrdBwmHandle *hP=0);
72
75static XrdBwmHandle *Free; // List of free handles
76static unsigned int numQueued;
77
82 unsigned long long ErrCBarg;
83 time_t qTime;
84 time_t rTime;
85 long long xSize;
86 long xTime;
88
89class theEICB : public XrdOucEICB
90{
91public:
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
103virtual ~theEICB() {}
104
105private:
108};
109#endif
Definition XrdBwmHandle.hh:90
XrdSysSemaphore mySem
Definition XrdBwmHandle.hh:106
void Done(int &Result, XrdOucErrInfo *eInfo, const char *Path=0)
Definition XrdBwmHandle.hh:93
theEICB()
Definition XrdBwmHandle.hh:101
void Wait()
Definition XrdBwmHandle.hh:99
virtual ~theEICB()
Definition XrdBwmHandle.hh:103
int Same(unsigned long long arg1, unsigned long long arg2)
Definition XrdBwmHandle.hh:96
Definition XrdBwmHandle.hh:42
HandleState
Definition XrdBwmHandle.hh:45
@ Dispatched
Definition XrdBwmHandle.hh:45
@ Scheduled
Definition XrdBwmHandle.hh:45
@ Idle
Definition XrdBwmHandle.hh:45
long long xSize
Definition XrdBwmHandle.hh:85
static XrdBwmPolicy * Policy
Definition XrdBwmHandle.hh:73
static unsigned int numQueued
Definition XrdBwmHandle.hh:76
const char * Name()
Definition XrdBwmHandle.hh:57
XrdOucEICB * ErrCB
Definition XrdBwmHandle.hh:81
int Activate(XrdOucErrInfo &einfo)
static XrdBwmHandle * Alloc(XrdBwmHandle *oldHandle=0)
HandleState Status
Definition XrdBwmHandle.hh:47
time_t rTime
Definition XrdBwmHandle.hh:84
XrdBwmPolicy::SchedParms Parms
Definition XrdBwmHandle.hh:79
XrdBwmHandle()
Definition XrdBwmHandle.hh:63
~XrdBwmHandle()
Definition XrdBwmHandle.hh:67
long xTime
Definition XrdBwmHandle.hh:86
static XrdBwmHandle * Free
Definition XrdBwmHandle.hh:75
static int setPolicy(XrdBwmPolicy *pP, XrdBwmLogger *lP)
static XrdBwmHandle * refHandle(int refID, XrdBwmHandle *hP=0)
XrdSysMutex hMutex
Definition XrdBwmHandle.hh:78
XrdBwmHandle::theEICB myEICB
unsigned long long ErrCBarg
Definition XrdBwmHandle.hh:82
time_t qTime
Definition XrdBwmHandle.hh:83
static XrdBwmLogger * Logger
Definition XrdBwmHandle.hh:74
int rHandle
Definition XrdBwmHandle.hh:87
static XrdBwmHandle * Alloc(const char *theUsr, const char *thePath, const char *lclNode, const char *rmtNode, int Incoming)
static void * Dispatch()
XrdBwmHandle * Next
Definition XrdBwmHandle.hh:80
Definition XrdBwmLogger.hh:41
Definition XrdBwmPolicy.hh:34
Definition XrdOucErrInfo.hh:483
Definition XrdOucErrInfo.hh:101
Definition XrdSysPthread.hh:165
Definition XrdSysPthread.hh:494
void Wait()
Definition XrdSysPthread.hh:509
void Post()
Definition XrdSysPthread.hh:505
Definition XrdBwmPolicy.hh:118
char * Lfn
Definition XrdBwmPolicy.hh:120