xrootd
|
Handle/Process/Forward XRootD messages. More...
#include <XrdClXRootDMsgHandler.hh>
Classes | |
struct | ChunkStatus |
Public Member Functions | |
XRootDMsgHandler (Message *msg, ResponseHandler *respHandler, const URL *url, std::shared_ptr< SIDManager > sidMgr, LocalFileHandler *lFileHandler) | |
~XRootDMsgHandler () | |
Destructor. | |
virtual uint16_t | Examine (std::shared_ptr< Message > &msg) |
virtual uint16_t | InspectStatusRsp () |
virtual uint16_t | GetSid () const |
virtual void | Process () |
virtual XRootDStatus | ReadMessageBody (Message *msg, Socket *socket, uint32_t &bytesRead) |
virtual uint8_t | OnStreamEvent (StreamEvent event, XRootDStatus status) |
virtual void | OnStatusReady (const Message *message, XRootDStatus status) |
The requested action has been performed and the status is available. | |
virtual bool | IsRaw () const |
Are we a raw writer or not? | |
XRootDStatus | WriteMessageBody (Socket *socket, uint32_t &bytesWritten) |
void | WaitDone (time_t now) |
void | SetExpiration (time_t expiration) |
Set a timestamp after which we give up. | |
time_t | GetExpiration () |
Get a timestamp after which we give up. | |
void | SetRedirectAsAnswer (bool redirectAsAnswer) |
void | SetOksofarAsAnswer (bool oksofarAsAnswer) |
const Message * | GetRequest () const |
Get the request pointer. | |
void | SetLoadBalancer (const HostInfo &loadBalancer) |
Set the load balancer. | |
void | SetHostList (HostList *hostList) |
Set host list. | |
void | SetChunkList (ChunkList *chunkList) |
Set the chunk list. | |
void | SetCrc32cDigests (std::vector< uint32_t > &&crc32cDigests) |
void | SetKernelBuffer (XrdSys::KernelBuffer *kbuff) |
Set the kernel buffer. | |
void | SetRedirectCounter (uint16_t redirectCounter) |
Set the redirect counter. | |
void | SetFollowMetalink (bool followMetalink) |
void | SetStateful (bool stateful) |
void | PartialReceived () |
Public Member Functions inherited from XrdCl::MsgHandler | |
virtual | ~MsgHandler () |
Event types that the message handler may receive. | |
virtual void | OnReadyToSend (Message *msg) |
Private Types | |
typedef std::list< std::unique_ptr< RedirectEntry > > | RedirectTraceBack |
Private Member Functions | |
void | HandleError (XRootDStatus status) |
Recover error. | |
Status | RetryAtServer (const URL &url, RedirectEntry::Type entryType) |
Retry the request at another server. | |
void | HandleResponse () |
Unpack the message and call the response handler. | |
XRootDStatus * | ProcessStatus () |
Extract the status information from the stuff that we got. | |
Status | ParseResponse (AnyObject *&response) |
Status | ParseXAttrResponse (char *data, size_t len, AnyObject *&response) |
Status | RewriteRequestRedirect (const URL &newUrl) |
Status | RewriteRequestWait () |
Some requests need to be rewritten also after getting kXR_wait - sigh. | |
void | UpdateTriedCGI (uint32_t errNo=0) |
Update the "tried=" part of the CGI of the current message. | |
void | SwitchOnRefreshFlag () |
Switch on the refresh flag for some requests. | |
void | HandleRspOrQueue () |
void | HandleLocalRedirect (URL *url) |
Handle a redirect to a local file. | |
bool | IsRetriable () |
bool | OmitWait (Message &request, const URL &url) |
bool | RetriableErrorResponse (const Status &status) |
void | DumpRedirectTraceBack () |
Dump the redirect-trace-back into the log file. | |
template<typename T > | |
Status | ReadFromBuffer (char *&buffer, size_t &buflen, T &result) |
Status | ReadFromBuffer (char *&buffer, size_t &buflen, std::string &result) |
Status | ReadFromBuffer (char *&buffer, size_t &buflen, size_t size, std::string &result) |
Static Private Member Functions | |
static size_t | NbPgPerRsp (uint64_t offset, uint32_t dlen) |
Static Private Attributes | |
static const size_t | CksumSize = sizeof( uint32_t ) |
static const size_t | PageWithCksum = XrdSys::PageSize + CksumSize |
static const size_t | MaxSslErrRetry = 3 |
Friends | |
class | HandleRspJob |
Additional Inherited Members | |
Public Types inherited from XrdCl::MsgHandler | |
enum | Action { None = 0x0000 , Nop = 0x0001 , Ignore = 0x0002 , RemoveHandler = 0x0004 , Raw = 0x0008 , NoProcess = 0x0010 , Corrupted = 0x0020 , More = 0x0040 } |
Actions to be taken after a message is processed by the handler. More... | |
enum | StreamEvent { Ready = 1 , Broken = 2 , Timeout = 3 , FatalError = 4 } |
Events that may have occurred to the stream. More... | |
Handle/Process/Forward XRootD messages.
|
private |
|
inline |
Constructor
msg | message that has been sent out |
respHandler | response handler to be called then the final final response arrives |
url | the url the message has been sent to |
sidMgr | the sid manager used to allocate SID for the initial message |
References XrdOucPgrwUtils::csNum(), XrdCl::Log::Debug(), XrdCl::ExDbgMsg, XrdCl::Buffer::GetBuffer(), XrdCl::Message::GetDescription(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::DefaultEnv::GetPostMaster(), XrdCl::Message::GetSessionId(), kXR_pgread, kXR_read, kXR_readv, ClientPgReadRequest::offset, pBodyReader, pCrc32cDigests, pHasSessionId, pPostMaster, pRequest, pUrl, ClientRequestHdr::requestid, and ClientPgReadRequest::rlen.
|
inline |
Destructor.
References XrdCl::Log::Debug(), DumpRedirectTraceBack(), XrdCl::ExDbgMsg, XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), pChunkList, pEffectiveDataServerUrl, pHasSessionId, pLFileHandler, pPostMaster, pRequest, pResponseHandler, and pUrl.
|
private |
Dump the redirect-trace-back into the log file.
Referenced by ~XRootDMsgHandler().
|
virtual |
Examine an incoming message, and decide on the action to be taken
msg | the message, may be zero if receive failed |
Implements XrdCl::MsgHandler.
|
inlinevirtual |
|
inline |
Get the request pointer.
References pRequest.
|
virtual |
|
private |
Recover error.
|
private |
Handle a redirect to a local file.
|
private |
Unpack the message and call the response handler.
|
private |
If the current thread is a worker thread from our thread-pool handle the response, otherwise submit a new task to the thread-pool
|
virtual |
Reexamine the incoming message, and decide on the action to be taken
In case of kXR_status the message can be only fully examined after reading the whole body (without raw data).
msg | the message, may be zero if receive failed |
Implements XrdCl::MsgHandler.
|
virtual |
Are we a raw writer or not?
Reimplemented from XrdCl::MsgHandler.
|
private |
Check if it is OK to retry this request
reuqest | : the request in question |
|
inlinestaticprivate |
References CksumSize, XrdSys::PageSize, and PageWithCksum.
Check if for given request and Metalink redirector it is OK to omit the kXR_wait and proceed stright to the next entry in the Metalink file
request | : the request in question |
url | : metalink URL |
|
virtual |
The requested action has been performed and the status is available.
Implements XrdCl::MsgHandler.
|
virtual |
Handle an event other that a message arrival
event | type of the event |
status | status info |
Reimplemented from XrdCl::MsgHandler.
Parse the response and put it in an object that could be passed to the user
|
private |
Parse the response to kXR_fattr request and put it in an object that could be passed to the user
void XrdCl::XRootDMsgHandler::PartialReceived | ( | ) |
Bookkeeping after partial response has been received:
|
virtual |
Process the message if it was "taken" by the examine action
msg | the message to be processed |
Reimplemented from XrdCl::MsgHandler.
|
private |
Extract the status information from the stuff that we got.
|
private |
Read a string from buffer
buffer | : the buffer with data |
buflen | : size of the buffer |
size | : size of the data to read |
result | : output parameter (data read) |
|
private |
Read a string from buffer
buffer | : the buffer with data |
buflen | : the size of the buffer |
result | : output parameter (data read) |
|
private |
Read data from buffer
buffer | : the buffer with data |
buflen | : the size of the buffer |
result | : output parameter (data read) |
|
virtual |
Read message body directly from a socket - called if Examine returns Raw flag - only socket related errors may be returned here
msg | the corresponding message header |
socket | the socket to read from |
bytesRead | number of bytes read by the method |
Reimplemented from XrdCl::MsgHandler.
|
private |
Checks if the given error returned by server is retriable.
status | : the status returned by the server |
|
private |
Retry the request at another server.
Perform the changes to the original request needed by the redirect procedure - allocate new streamid, append redirection data and such
|
private |
Some requests need to be rewritten also after getting kXR_wait - sigh.
|
inline |
Set the chunk list.
References pBodyReader, pChunkList, and pChunkStatus.
|
inline |
References pCrc32cDigests.
|
inline |
Set a timestamp after which we give up.
References pExpiration.
|
inline |
References pFollowMetalink.
|
inline |
Set host list.
References pHosts.
|
inline |
Set the kernel buffer.
References pKBuff.
|
inline |
Set the load balancer.
References XrdCl::URL::IsValid(), pHasLoadBalancer, pLoadBalancer, and XrdCl::HostInfo::url.
|
inline |
Treat the kXR_oksofar response as a valid answer to the message and notify the handler with the URL as a response
References pOksofarAsAnswer.
|
inline |
Treat the kXR_redirect response as a valid answer to the message and notify the handler with the URL as a response
References pRedirectAsAnswer.
|
inline |
Set the redirect counter.
References pRedirectCounter.
|
inline |
References pStateful.
|
private |
Switch on the refresh flag for some requests.
|
private |
Update the "tried=" part of the CGI of the current message.
void XrdCl::XRootDMsgHandler::WaitDone | ( | time_t | now | ) |
Called after the wait time for kXR_wait has elapsed
now | current timestamp |
|
virtual |
Write message body directly to a socket - called if IsRaw returns true - only socket related errors may be returned here
socket | the socket to read from |
bytesWritten | number of bytes written by the method |
Reimplemented from XrdCl::MsgHandler.
|
friend |
|
staticprivate |
Referenced by NbPgPerRsp().
|
staticprivate |
|
staticprivate |
Referenced by NbPgPerRsp().
|
private |
|
private |
|
private |
|
private |
Referenced by SetChunkList(), and XRootDMsgHandler().
|
private |
Referenced by SetChunkList(), and ~XRootDMsgHandler().
|
private |
Referenced by SetChunkList().
|
private |
Referenced by SetCrc32cDigests(), and XRootDMsgHandler().
|
private |
|
private |
|
private |
|
private |
Referenced by ~XRootDMsgHandler().
|
private |
Referenced by GetExpiration(), and SetExpiration().
|
private |
Referenced by SetFollowMetalink().
|
private |
Referenced by SetLoadBalancer().
|
private |
Referenced by XRootDMsgHandler(), and ~XRootDMsgHandler().
|
private |
Referenced by SetHostList().
|
private |
Referenced by SetKernelBuffer().
|
private |
|
private |
Referenced by ~XRootDMsgHandler().
|
private |
Referenced by SetLoadBalancer().
|
private |
|
private |
|
private |
Referenced by SetOksofarAsAnswer().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Referenced by XRootDMsgHandler(), and ~XRootDMsgHandler().
|
private |
|
private |
Referenced by SetRedirectAsAnswer().
|
private |
Referenced by SetRedirectCounter().
|
private |
|
private |
|
private |
Referenced by GetRequest(), XRootDMsgHandler(), and ~XRootDMsgHandler().
|
private |
|
private |
Referenced by ~XRootDMsgHandler().
|
private |
|
private |
|
private |
Referenced by SetStateful().
|
private |
|
private |
|
private |
Referenced by XRootDMsgHandler(), and ~XRootDMsgHandler().