xrootd
XrdSsiTaskReal.hh
Go to the documentation of this file.
1#ifndef __XRDSSITASKREAL_HH__
2#define __XRDSSITASKREAL_HH__
3/******************************************************************************/
4/* */
5/* X r d S s i T a s k 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 <stdio.h>
33
35#include "XrdSsi/XrdSsiEvent.hh"
36#include "XrdSsi/XrdSsiPacer.hh"
39
40class XrdSsiRequest;
41class XrdSsiSessReal;
42class XrdSysSemaphore;
43
44class XrdSsiTaskReal : public XrdSsiEvent, public XrdSsiPacer,
45 public XrdSsiResponder, public XrdSsiStream
46{
47public:
48
50
51void Detach(bool force=false);
52
54 const XrdSsiRespInfo &rInfo,
55 bool cancel=false);
56
57void *Implementation() {return (void *)this;}
58
59bool Kill();
60
61inline
62int ID() {return tskID;}
63
64inline
65void Init(XrdSsiRequest *rP, unsigned short tmo=0)
66 {rqstP = rP, tStat = isPend; tmOut = tmo; wPost = 0;
67 mhPend = false; defer = false;
68 attList.next = attList.prev = this;
69 if (mdResp) {delete mdResp; mdResp = 0;}
70 }
71
72void PostError();
73
74void Redrive();
75const
76char *RequestID() {return rqstP->GetRequestID();}
77
79
80void SendError();
81
82bool SendRequest(const char *node);
83
84int SetBuff(XrdSsiErrInfo &eRef, char *buff, int blen, bool &last);
85
86bool SetBuff(XrdSsiErrInfo &eRef, char *buff, int blen);
87
88void SetTaskID(uint32_t tid, uint32_t sid)
89 {tskID = tid;
90 snprintf(tident, sizeof(tident), "T %u#%u", sid, tid);
91 }
92
94
97 sessP(sP), mdResp(0), wPost(0), tskID(0),
98 mhPend(false), defer(false)
99 {}
100
102
105
107
108private:
109
110bool Ask4Resp();
111respType GetResp(XrdCl::AnyObject **respP, char *&dbuf, int &dlen);
113bool XeqEnd(bool getLock);
114
123uint32_t tskID;
124unsigned short tmOut;
126bool defer;
127};
128#endif
Definition: XrdClAnyObject.hh:33
Request status.
Definition: XrdClXRootDResponses.hh:213
Definition: XrdSsiErrInfo.hh:41
Definition: XrdSsiEvent.hh:37
char tident[24]
Definition: XrdSsiEvent.hh:59
Definition: XrdSsiPacer.hh:37
Definition: XrdSsiRequest.hh:71
const char * GetRequestID()
Definition: XrdSsiRequest.hh:147
Definition: XrdSsiResponder.hh:69
Definition: XrdSsiSessReal.hh:45
Definition: XrdSsiStream.hh:54
@ isPassive
Definition: XrdSsiStream.hh:144
Definition: XrdSsiTaskReal.hh:46
bool RespErr(XrdCl::XRootDStatus *status)
int dataRlen
Definition: XrdSsiTaskReal.hh:121
XrdSsiTaskReal(XrdSsiSessReal *sP)
Definition: XrdSsiTaskReal.hh:95
respType GetResp(XrdCl::AnyObject **respP, char *&dbuf, int &dlen)
char * dataBuff
Definition: XrdSsiTaskReal.hh:120
dlQ attList
Definition: XrdSsiTaskReal.hh:104
~XrdSsiTaskReal()
Definition: XrdSsiTaskReal.hh:101
void Finished(XrdSsiRequest &rqstR, const XrdSsiRespInfo &rInfo, bool cancel=false)
int SetBuff(XrdSsiErrInfo &eRef, char *buff, int blen, bool &last)
void Init(XrdSsiRequest *rP, unsigned short tmo=0)
Definition: XrdSsiTaskReal.hh:65
XrdSsiRequest * rqstP
Definition: XrdSsiTaskReal.hh:117
bool XeqEnd(bool getLock)
int ID()
Definition: XrdSsiTaskReal.hh:62
void SchedError(XrdSsiErrInfo *eInfo=0)
unsigned short tmOut
Definition: XrdSsiTaskReal.hh:124
void * Implementation()
Definition: XrdSsiTaskReal.hh:57
bool SendRequest(const char *node)
void SetTaskID(uint32_t tid, uint32_t sid)
Definition: XrdSsiTaskReal.hh:88
XrdSsiErrInfo errInfo
Definition: XrdSsiTaskReal.hh:115
TaskStat
Definition: XrdSsiTaskReal.hh:49
@ isDone
Definition: XrdSsiTaskReal.hh:49
@ isDead
Definition: XrdSsiTaskReal.hh:49
@ isWrite
Definition: XrdSsiTaskReal.hh:49
@ isReady
Definition: XrdSsiTaskReal.hh:49
@ isSync
Definition: XrdSsiTaskReal.hh:49
@ isPend
Definition: XrdSsiTaskReal.hh:49
XrdSysSemaphore * wPost
Definition: XrdSsiTaskReal.hh:119
XrdSsiSessReal * sessP
Definition: XrdSsiTaskReal.hh:116
XrdCl::AnyObject * mdResp
Definition: XrdSsiTaskReal.hh:118
TaskStat tStat
Definition: XrdSsiTaskReal.hh:122
respType
Definition: XrdSsiTaskReal.hh:106
@ isAlert
Definition: XrdSsiTaskReal.hh:106
@ isStream
Definition: XrdSsiTaskReal.hh:106
@ isData
Definition: XrdSsiTaskReal.hh:106
@ isBad
Definition: XrdSsiTaskReal.hh:106
void Detach(bool force=false)
bool SetBuff(XrdSsiErrInfo &eRef, char *buff, int blen)
const char * RequestID()
Definition: XrdSsiTaskReal.hh:76
uint32_t tskID
Definition: XrdSsiTaskReal.hh:123
bool defer
Definition: XrdSsiTaskReal.hh:126
bool XeqEvent(XrdCl::XRootDStatus *status, XrdCl::AnyObject **respP)
bool mhPend
Definition: XrdSsiTaskReal.hh:125
Definition: XrdSysPthread.hh:404
Definition: XrdSsiRespInfo.hh:44
Definition: XrdSsiTaskReal.hh:103
XrdSsiTaskReal * prev
Definition: XrdSsiTaskReal.hh:103
XrdSsiTaskReal * next
Definition: XrdSsiTaskReal.hh:103