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. More... | |
virtual uint16_t | Examine (Message *msg) |
virtual uint16_t | InspectStatusRsp (Message *msg) |
virtual uint16_t | GetSid () const |
virtual void | Process (Message *msg) |
virtual Status | 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. More... | |
virtual bool | IsRaw () const |
Are we a raw writer or not? More... | |
Status | WriteMessageBody (Socket *socket, uint32_t &bytesWritten) |
void | WaitDone (time_t now) |
void | SetExpiration (time_t expiration) |
Set a timestamp after which we give up. More... | |
void | SetRedirectAsAnswer (bool redirectAsAnswer) |
void | SetOksofarAsAnswer (bool oksofarAsAnswer) |
const Message * | GetRequest () const |
Get the request pointer. More... | |
void | SetLoadBalancer (const HostInfo &loadBalancer) |
Set the load balancer. More... | |
void | SetHostList (HostList *hostList) |
Set host list. More... | |
void | SetChunkList (ChunkList *chunkList) |
Set the chunk list. More... | |
void | SetKernelBuffer (XrdSys::KernelBuffer *kbuff) |
Set the kernel buffer. More... | |
void | SetRedirectCounter (uint16_t redirectCounter) |
Set the redirect counter. More... | |
void | SetFollowMetalink (bool followMetalink) |
void | SetStateful (bool stateful) |
void | TakeDownTimeoutFence () |
Take down the timeout fence after oksofar response has been handled. More... | |
![]() | |
virtual | ~IncomingMsgHandler () |
Event types that the message handler may receive. More... | |
![]() | |
virtual | ~OutgoingMsgHandler () |
virtual void | OnReadyToSend (Message *msg) |
Private Types | |
typedef std::list< std::unique_ptr< RedirectEntry > > | RedirectTraceBack |
Private Member Functions | |
Status | ReadRawRead (Message *msg, Socket *socket, uint32_t &bytesRead) |
Handle a kXR_read in raw mode. More... | |
Status | ReadRawPgRead (Message *msg, Socket *socket, uint32_t &bytesRead) |
Handle a kXR_pgread in raw mode. More... | |
Status | ReadRawReadV (Message *msg, Socket *socket, uint32_t &bytesRead) |
Handle a kXR_readv in raw mode. More... | |
Status | ReadRawOther (Message *msg, Socket *socket, uint32_t &bytesRead) |
Handle anything other than kXR_read and kXR_readv in raw mode. More... | |
Status | ReadAsync (Socket *socket, uint32_t &bytesRead) |
Status | ReadPagesAsync (Socket *socket, uint32_t &bytesRead) |
Status | ReadPageAsync (Socket *socket, uint32_t &bytesRead) |
void | HandleError (XRootDStatus status, Message *msg=0) |
Recover error. More... | |
Status | RetryAtServer (const URL &url, RedirectEntry::Type entryType) |
Retry the request at another server. More... | |
void | HandleResponse () |
Unpack the message and call the response handler. More... | |
XRootDStatus * | ProcessStatus () |
Extract the status information from the stuff that we got. More... | |
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. More... | |
Status | PostProcessReadV (VectorReadInfo *vReadInfo) |
Post process vector read. More... | |
Status | UnPackReadVResponse (Message *msg) |
Unpack a single readv response. More... | |
void | UpdateTriedCGI (uint32_t errNo=0) |
Update the "tried=" part of the CGI of the current message. More... | |
void | SwitchOnRefreshFlag () |
Switch on the refresh flag for some requests. More... | |
void | HandleRspOrQueue () |
void | HandleLocalRedirect (URL *url) |
Handle a redirect to a local file. More... | |
bool | IsRetriable (Message *request) |
bool | OmitWait (Message *request, const URL &url) |
bool | RetriableErrorResponse (const Status &status) |
void | DumpRedirectTraceBack () |
Dump the redirect-trace-back into the log file. More... | |
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) |
void | Copy (uint32_t offchlst, char *buffer, size_t length) |
Static Private Member Functions | |
static Status | ReadBytesAsync (Socket *socket, char *&buffer, uint32_t toBeRead, uint32_t &bytesRead) |
Read a buffer asynchronously. More... | |
static size_t | NbPages (uint32_t dlen) |
Static Private Attributes | |
static const size_t | PageSize = XrdSys::PageSize |
static const size_t | CksumSize = sizeof( uint32_t ) |
static const size_t | PageWithCksum = PageSize + CksumSize |
Friends | |
class | HandleRspJob |
Additional Inherited Members | |
![]() | |
enum | Action { None = 0x0000, Take = 0x0001, Ignore = 0x0002, RemoveHandler = 0x0004, Raw = 0x0008, NoProcess = 0x0010, Corrupted = 0x0020 } |
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 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, NbPages(), pHasSessionId, pPgReadCksums, pPostMaster, pReadVRawChunkHeader, pRequest, pUrl, ClientRequestHdr::requestid, and ClientPgReadRequest::rlen.
|
inline |
|
inlineprivate |
References pChunkList.
|
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::IncomingMsgHandler.
|
inline |
Get the request pointer.
References pRequest.
|
virtual |
Get handler sid
return sid of the corresponding request, otherwise 0
Implements XrdCl::IncomingMsgHandler.
|
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::IncomingMsgHandler.
|
virtual |
Are we a raw writer or not?
Reimplemented from XrdCl::OutgoingMsgHandler.
|
private |
Check if it is OK to retry this request
reuqest | : the request in question |
|
inlinestaticprivate |
References PageWithCksum.
Referenced by XRootDMsgHandler().
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
reuqest | : the request in question |
url | : metalink URL |
|
virtual |
The requested action has been performed and the status is available.
Implements XrdCl::OutgoingMsgHandler.
|
virtual |
Handle an event other that a message arrival
event | type of the event |
streamNum | stream concerned |
status | status info |
Reimplemented from XrdCl::IncomingMsgHandler.
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
|
private |
Post process vector read.
|
virtual |
Process the message if it was "taken" by the examine action
msg | the message to be processed |
Reimplemented from XrdCl::IncomingMsgHandler.
|
private |
Extract the status information from the stuff that we got.
Read a buffer asynchronously - depends on pAsyncBuffer, pAsyncSize and pAsyncOffset
References pAsyncOffset, pAsyncReadBuffer, pAsyncReadSize, and ReadBytesAsync().
|
staticprivate |
Read a buffer asynchronously.
Referenced by ReadAsync().
|
private |
Read data from buffer
buffer | : the buffer with data |
size | : the size of the buffer |
result | : output parameter (data read) |
|
private |
Read a string from buffer
buffer | : the buffer with data |
size | : the size of the buffer |
result | : output parameter (data read) |
|
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) |
|
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::IncomingMsgHandler.
Read a single page asynchronously - depends on pAsyncBuffer, pAsyncSize and pAsyncOffset
Referenced by ReadPagesAsync().
|
inlineprivate |
Read all page asynchronously - depends on pAsyncBuffer, pAsyncSize and pAsyncOffset
References XrdCl::Status::code, XrdCl::Status::IsOK(), pAsyncOffset, pAsyncReadSize, ReadPageAsync(), and XrdCl::suRetry.
|
private |
Handle anything other than kXR_read and kXR_readv in raw mode.
|
private |
Handle a kXR_pgread in raw mode.
|
private |
Handle a kXR_read in raw mode.
|
private |
Handle a kXR_readv in raw mode.
|
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 pChunkList, and pChunkStatus.
|
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.
void XrdCl::XRootDMsgHandler::TakeDownTimeoutFence | ( | ) |
Take down the timeout fence after oksofar response has been handled.
Unpack a single readv response.
|
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 |
bytesRead | number of bytes read by the method |
Reimplemented from XrdCl::OutgoingMsgHandler.
|
friend |
|
staticprivate |
|
staticprivate |
Referenced by NbPages().
|
private |
|
private |
|
private |
|
private |
|
private |
Referenced by ReadAsync(), and ReadPagesAsync().
|
private |
Referenced by ReadAsync().
|
private |
Referenced by ReadAsync(), and ReadPagesAsync().
|
private |
Referenced by Copy(), SetChunkList(), and ~XRootDMsgHandler().
|
private |
Referenced by SetChunkList().
|
private |
|
private |
|
private |
|
private |
Referenced by ~XRootDMsgHandler().
|
private |
Referenced by SetExpiration().
|
private |
Referenced by SetFollowMetalink().
|
private |
Referenced by SetLoadBalancer().
|
private |
Referenced by XRootDMsgHandler(), and ~XRootDMsgHandler().
|
private |
Referenced by SetHostList(), and ~XRootDMsgHandler().
|
private |
Referenced by SetKernelBuffer().
|
private |
|
private |
Referenced by ~XRootDMsgHandler().
|
private |
Referenced by SetLoadBalancer().
|
private |
|
private |
|
private |
Referenced by SetOksofarAsAnswer().
|
private |
|
private |
Referenced by ~XRootDMsgHandler().
|
private |
|
private |
Referenced by XRootDMsgHandler().
|
private |
Referenced by XRootDMsgHandler(), and ~XRootDMsgHandler().
|
private |
|
private |
|
private |
|
private |
Referenced by XRootDMsgHandler().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
Referenced by SetRedirectAsAnswer().
|
private |
Referenced by SetRedirectCounter().
|
private |
|
private |
|
private |
Referenced by GetRequest(), XRootDMsgHandler(), and ~XRootDMsgHandler().
|
private |
Referenced by ~XRootDMsgHandler().
|
private |
Referenced by ~XRootDMsgHandler().
|
private |
|
private |
Referenced by SetStateful().
|
private |
|
private |
|
private |
Referenced by XRootDMsgHandler(), and ~XRootDMsgHandler().