xrootd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
XrdSsiSessReal.hh
Go to the documentation of this file.
1 #ifndef __XRDSSISESSREAL_HH__
2 #define __XRDSSISESSREAL_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d S s i S e s s R e a l . h h */
6 /* */
7 /* (c) 2013 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* Produced by Andrew Hanushevsky for Stanford University under contract */
9 /* DE-AC02-76-SFO0515 with the Department of Energy */
10 /* */
11 /* This file is part of the XRootD software suite. */
12 /* */
13 /* XRootD is free software: you can redistribute it and/or modify it under */
14 /* the terms of the GNU Lesser General Public License as published by the */
15 /* Free Software Foundation, either version 3 of the License, or (at your */
16 /* option) any later version. */
17 /* */
18 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */
19 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
20 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
21 /* License for more details. */
22 /* */
23 /* You should have received a copy of the GNU Lesser General Public License */
24 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
25 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
26 /* */
27 /* The copyright holder's institutional names and contributor's names may not */
28 /* be used to endorse or promote products derived from this software without */
29 /* specific prior written permission of the institution or contributor. */
30 /******************************************************************************/
31 
32 #include <string.h>
33 
34 #include "XrdCl/XrdClFile.hh"
35 
36 #include "XrdSsi/XrdSsiAtomics.hh"
37 #include "XrdSsi/XrdSsiEvent.hh"
38 
39 #include "XrdSys/XrdSysPthread.hh"
40 
41 class XrdSsiServReal;
42 class XrdSsiTaskReal;
43 
45 {
46 public:
47 
49 
50 const char *GetKey() {return resKey;}
51 
52  void InitSession(XrdSsiServReal *servP,
53  const char *sName,
54  int uent,
55  bool hold);
56 
57  void Lock() {sessMutex.Lock();}
58 
60 
61  bool Provision(XrdSsiRequest *reqP, const char *epURL);
62 
63  bool Run(XrdSsiRequest *reqP);
64 
65  void SetKey(const char *key)
66  {if (resKey) free(resKey);
67  resKey = (key ? strdup(key) : 0);
68  }
69 
70  void TaskFinished(XrdSsiTaskReal *tP);
71 
72  void UnHold(bool cleanup=true);
73 
74  void UnLock() {sessMutex.UnLock();}
75 
76  void Unprovision();
77 
78  bool XeqEvent(XrdCl::XRootDStatus *status,
79  XrdCl::AnyObject **respP);
80 
82  const char *sName,
83  int uent,
84  bool hold=false)
85  : XrdSsiEvent("SessReal"),
86  sessMutex(XrdSsiMutex::Recursive),
87  resKey(0), sessName(0), sessNode(0)
88  {InitSession(servP, sName, uent, hold);}
89 
91 
93 
94 private:
96 void RelTask(XrdSsiTaskReal *tP);
97 void Shutdown(XrdCl::XRootDStatus &epStatus, bool onClose);
98 
104 char *resKey;
105 char *sessName;
106 char *sessNode;
107 uint32_t nextTID;
108 uint32_t alocLeft;
109 int16_t uEnt; // User index for scaling
110 bool isHeld;
111 bool inOpen;
112 bool noReuse;
113 };
114 #endif
void UnHold(bool cleanup=true)
XrdSsiMutex * MutexP()
Definition: XrdSsiSessReal.hh:59
void Lock()
Definition: XrdSsiAtomics.hh:116
Definition: XrdSsiAtomics.hh:110
Definition: XrdClAnyObject.hh:32
int16_t uEnt
Definition: XrdSsiSessReal.hh:109
char * sessNode
Definition: XrdSsiSessReal.hh:106
void Unprovision()
XrdSsiTaskReal * attBase
Definition: XrdSsiSessReal.hh:101
void Lock()
Definition: XrdSsiSessReal.hh:57
bool isHeld
Definition: XrdSsiSessReal.hh:110
XrdSsiSessReal * nextSess
Definition: XrdSsiSessReal.hh:48
Definition: XrdSsiSessReal.hh:44
XrdSsiTaskReal * NewTask(XrdSsiRequest *reqP)
Definition: XrdSsiServReal.hh:41
XrdSsiMutex sessMutex
Definition: XrdSsiSessReal.hh:99
const char * GetKey()
Definition: XrdSsiSessReal.hh:50
uint32_t alocLeft
Definition: XrdSsiSessReal.hh:108
XrdSsiTaskReal * freeTask
Definition: XrdSsiSessReal.hh:102
void RelTask(XrdSsiTaskReal *tP)
XrdSsiRequest * requestP
Definition: XrdSsiSessReal.hh:103
uint32_t nextTID
Definition: XrdSsiSessReal.hh:107
XrdSsiServReal * myService
Definition: XrdSsiSessReal.hh:100
void TaskFinished(XrdSsiTaskReal *tP)
A file.
Definition: XrdClFile.hh:44
bool Provision(XrdSsiRequest *reqP, const char *epURL)
void SetKey(const char *key)
Definition: XrdSsiSessReal.hh:65
XrdCl::File epFile
Definition: XrdSsiSessReal.hh:92
bool inOpen
Definition: XrdSsiSessReal.hh:111
bool XeqEvent(XrdCl::XRootDStatus *status, XrdCl::AnyObject **respP)
Request status.
Definition: XrdClXRootDResponses.hh:212
void InitSession(XrdSsiServReal *servP, const char *sName, int uent, bool hold)
Definition: XrdSsiEvent.hh:36
Definition: XrdSsiRequest.hh:70
bool Run(XrdSsiRequest *reqP)
void UnLock()
Definition: XrdSsiSessReal.hh:74
XrdSsiSessReal(XrdSsiServReal *servP, const char *sName, int uent, bool hold=false)
Definition: XrdSsiSessReal.hh:81
char * resKey
Definition: XrdSsiSessReal.hh:104
char * sessName
Definition: XrdSsiSessReal.hh:105
Definition: XrdSsiTaskReal.hh:42
void Shutdown(XrdCl::XRootDStatus &epStatus, bool onClose)
void UnLock()
Definition: XrdSsiAtomics.hh:118
bool noReuse
Definition: XrdSsiSessReal.hh:112