XrdCl::XRootDMsgHandler Class Reference

Handle/Process/Forward XRootD messages. More...

#include <XrdClXRootDMsgHandler.hh>

Inheritance diagram for XrdCl::XRootDMsgHandler:
Inheritance graph
[legend]
Collaboration diagram for XrdCl::XRootDMsgHandler:
Collaboration graph
[legend]

List of all members.

Classes

struct  ChunkStatus

Public Member Functions

 XRootDMsgHandler (Message *msg, ResponseHandler *respHandler, const URL *url, SIDManager *sidMgr, LocalFileHandler *lFileHandler)
 ~XRootDMsgHandler ()
 Destructor.
virtual uint16_t Examine (Message *msg)
virtual uint16_t GetSid () const
virtual void Process (Message *msg)
virtual Status ReadMessageBody (Message *msg, int socket, uint32_t &bytesRead)
virtual uint8_t OnStreamEvent (StreamEvent event, uint16_t streamNum, Status status)
virtual void OnStatusReady (const Message *message, Status status)
 The requested action has been performed and the status is available.
virtual bool IsRaw () const
 Are we a raw writer or not?
Status WriteMessageBody (int socket, uint32_t &bytesRead)
ChunkListGetMessageBody (uint32_t *&asyncOffset)
void WaitDone (time_t now)
void SetExpiration (time_t expiration)
 Set a timestamp after which we give up.
void SetRedirectAsAnswer (bool redirectAsAnswer)
void SetOksofarAsAnswer (bool oksofarAsAnswer)
const MessageGetRequest () 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 SetRedirectCounter (uint16_t redirectCounter)
 Set the redirect counter.
void SetFollowMetalink (bool followMetalink)
void SetStateful (bool stateful)
void TakeDownTimeoutFence ()
 Take down the timeout fence after oksofar response has been handled.

Private Types

typedef std::list
< std::unique_ptr
< RedirectEntry > > 
RedirectTraceBack

Private Member Functions

Status ReadRawRead (Message *msg, int socket, uint32_t &bytesRead)
 Handle a kXR_read in raw mode.
Status ReadRawReadV (Message *msg, int socket, uint32_t &bytesRead)
 Handle a kXR_readv in raw mode.
Status ReadRawOther (Message *msg, int socket, uint32_t &bytesRead)
 Handle anything other than kXR_read and kXR_readv in raw mode.
Status ReadAsync (int socket, uint32_t &btesRead)
void HandleError (Status status, Message *msg=0)
 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.
XRootDStatusProcessStatus ()
 Extract the status information from the stuff that we got.
Status ParseResponse (AnyObject *&response)
Status RewriteRequestRedirect (const URL &newUrl)
Status RewriteRequestWait ()
 Some requests need to be rewritten also after getting kXR_wait - sigh.
Status PostProcessReadV (VectorReadInfo *vReadInfo)
 Post process vector read.
Status UnPackReadVResponse (Message *msg)
 Unpack a single readv response.
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 (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.

Private Attributes

MessagepRequest
MessagepResponse
std::vector< Message * > pPartialResps
ResponseHandlerpResponseHandler
URL pUrl
URLpEffectiveDataServerUrl
PostMasterpPostMaster
SIDManagerpSidMgr
LocalFileHandlerpLFileHandler
Status pStatus
Status pLastError
time_t pExpiration
bool pRedirectAsAnswer
bool pOksofarAsAnswer
HostListpHosts
bool pHasLoadBalancer
HostInfo pLoadBalancer
bool pHasSessionId
std::string pRedirectUrl
ChunkListpChunkList
std::vector< ChunkStatuspChunkStatus
uint16_t pRedirectCounter
uint16_t pNotAuthorizedCounter
uint32_t pAsyncOffset
uint32_t pAsyncReadSize
char * pAsyncReadBuffer
uint32_t pAsyncMsgSize
bool pReadRawStarted
uint32_t pReadRawCurrentOffset
uint32_t pReadVRawMsgOffset
bool pReadVRawChunkHeaderDone
bool pReadVRawChunkHeaderStarted
bool pReadVRawSizeError
int32_t pReadVRawChunkIndex
readahead_list pReadVRawChunkHeader
bool pReadVRawMsgDiscard
bool pOtherRawStarted
bool pFollowMetalink
bool pStateful
int pAggregatedWaitTime
std::unique_ptr< RedirectEntrypRdirEntry
RedirectTraceBack pRedirectTraceBack
bool pMsgInFly
bool pTimeoutFence
bool pDirListStarted
bool pDirListWithStat
XrdSysCondVar pCV

Friends

class HandleRspJob

Detailed Description

Handle/Process/Forward XRootD messages.


Member Typedef Documentation

typedef std::list<std::unique_ptr<RedirectEntry> > XrdCl::XRootDMsgHandler::RedirectTraceBack [private]

Constructor & Destructor Documentation

XrdCl::XRootDMsgHandler::XRootDMsgHandler ( Message msg,
ResponseHandler respHandler,
const URL url,
SIDManager sidMgr,
LocalFileHandler lFileHandler 
) [inline]

Constructor

Parameters:
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::Message::GetDescription(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::DefaultEnv::GetPostMaster(), XrdCl::Message::GetSessionId(), pHasSessionId, pPostMaster, pReadVRawChunkHeader, pRequest, and pUrl.

XrdCl::XRootDMsgHandler::~XRootDMsgHandler (  )  [inline]

Member Function Documentation

void XrdCl::XRootDMsgHandler::DumpRedirectTraceBack (  )  [private]

Dump the redirect-trace-back into the log file.

Referenced by ~XRootDMsgHandler().

virtual uint16_t XrdCl::XRootDMsgHandler::Examine ( Message msg  )  [virtual]

Examine an incoming message, and decide on the action to be taken

Parameters:
msg the message, may be zero if receive failed
Returns:
action type that needs to be take wrt the message and the handler

Implements XrdCl::IncomingMsgHandler.

ChunkList* XrdCl::XRootDMsgHandler::GetMessageBody ( uint32_t *&  asyncOffset  )  [inline]

Get message body - called if IsRaw returns true

Parameters:
asyncOffset : the current async offset
Returns:
: the list of chunks

References pAsyncOffset, and pChunkList.

const Message* XrdCl::XRootDMsgHandler::GetRequest (  )  const [inline]

Get the request pointer.

References pRequest.

virtual uint16_t XrdCl::XRootDMsgHandler::GetSid (  )  const [virtual]

Get handler sid

return sid of the corresponding request, otherwise 0

Implements XrdCl::IncomingMsgHandler.

void XrdCl::XRootDMsgHandler::HandleError ( Status  status,
Message msg = 0 
) [private]

Recover error.

void XrdCl::XRootDMsgHandler::HandleLocalRedirect ( URL url  )  [private]

Handle a redirect to a local file.

void XrdCl::XRootDMsgHandler::HandleResponse (  )  [private]

Unpack the message and call the response handler.

void XrdCl::XRootDMsgHandler::HandleRspOrQueue (  )  [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 bool XrdCl::XRootDMsgHandler::IsRaw (  )  const [virtual]

Are we a raw writer or not?

Reimplemented from XrdCl::OutgoingMsgHandler.

bool XrdCl::XRootDMsgHandler::IsRetriable ( Message request  )  [private]

Check if it is OK to retry this request

Parameters:
reuqest : the request in question
Returns:
: true if yes, false if no
bool XrdCl::XRootDMsgHandler::OmitWait ( Message request,
const URL url 
) [private]

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

Parameters:
reuqest : the request in question
url : metalink URL
Returns:
: true if yes, false if no
virtual void XrdCl::XRootDMsgHandler::OnStatusReady ( const Message message,
Status  status 
) [virtual]

The requested action has been performed and the status is available.

Implements XrdCl::OutgoingMsgHandler.

virtual uint8_t XrdCl::XRootDMsgHandler::OnStreamEvent ( StreamEvent  event,
uint16_t  streamNum,
Status  status 
) [virtual]

Handle an event other that a message arrival

Parameters:
event type of the event
streamNum stream concerned
status status info

Reimplemented from XrdCl::IncomingMsgHandler.

Status XrdCl::XRootDMsgHandler::ParseResponse ( AnyObject *&  response  )  [private]

Parse the response and put it in an object that could be passed to the user

Status XrdCl::XRootDMsgHandler::PostProcessReadV ( VectorReadInfo vReadInfo  )  [private]

Post process vector read.

virtual void XrdCl::XRootDMsgHandler::Process ( Message msg  )  [virtual]

Process the message if it was "taken" by the examine action

Parameters:
msg the message to be processed

Reimplemented from XrdCl::IncomingMsgHandler.

XRootDStatus* XrdCl::XRootDMsgHandler::ProcessStatus (  )  [private]

Extract the status information from the stuff that we got.

Status XrdCl::XRootDMsgHandler::ReadAsync ( int  socket,
uint32_t &  btesRead 
) [private]

Read a buffer asynchronously - depends on pAsyncBuffer, pAsyncSize and pAsyncOffset

virtual Status XrdCl::XRootDMsgHandler::ReadMessageBody ( Message msg,
int  socket,
uint32_t &  bytesRead 
) [virtual]

Read message body directly from a socket - called if Examine returns Raw flag - only socket related errors may be returned here

Parameters:
msg the corresponding message header
socket the socket to read from
bytesRead number of bytes read by the method
Returns:
stOK & suDone if the whole body has been processed stOK & suRetry if more data is needed stError on failure

Reimplemented from XrdCl::IncomingMsgHandler.

Status XrdCl::XRootDMsgHandler::ReadRawOther ( Message msg,
int  socket,
uint32_t &  bytesRead 
) [private]

Handle anything other than kXR_read and kXR_readv in raw mode.

Status XrdCl::XRootDMsgHandler::ReadRawRead ( Message msg,
int  socket,
uint32_t &  bytesRead 
) [private]

Handle a kXR_read in raw mode.

Status XrdCl::XRootDMsgHandler::ReadRawReadV ( Message msg,
int  socket,
uint32_t &  bytesRead 
) [private]

Handle a kXR_readv in raw mode.

bool XrdCl::XRootDMsgHandler::RetriableErrorResponse ( const Status status  )  [private]

Checks if the given error returned by server is retriable.

Parameters:
status : the status returned by the server
Returns:
: true if the load-balancer is a MetaManager and the error is retriable for MetaManagers
Status XrdCl::XRootDMsgHandler::RetryAtServer ( const URL url,
RedirectEntry::Type  entryType 
) [private]

Retry the request at another server.

Status XrdCl::XRootDMsgHandler::RewriteRequestRedirect ( const URL newUrl  )  [private]

Perform the changes to the original request needed by the redirect procedure - allocate new streamid, append redirection data and such

Status XrdCl::XRootDMsgHandler::RewriteRequestWait (  )  [private]

Some requests need to be rewritten also after getting kXR_wait - sigh.

void XrdCl::XRootDMsgHandler::SetChunkList ( ChunkList chunkList  )  [inline]

Set the chunk list.

References pChunkList, and pChunkStatus.

void XrdCl::XRootDMsgHandler::SetExpiration ( time_t  expiration  )  [inline]

Set a timestamp after which we give up.

References pExpiration.

void XrdCl::XRootDMsgHandler::SetFollowMetalink ( bool  followMetalink  )  [inline]

References pFollowMetalink.

void XrdCl::XRootDMsgHandler::SetHostList ( HostList hostList  )  [inline]

Set host list.

References pHosts.

void XrdCl::XRootDMsgHandler::SetLoadBalancer ( const HostInfo loadBalancer  )  [inline]

Set the load balancer.

References XrdCl::URL::IsValid(), pHasLoadBalancer, pLoadBalancer, and XrdCl::HostInfo::url.

void XrdCl::XRootDMsgHandler::SetOksofarAsAnswer ( bool  oksofarAsAnswer  )  [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.

void XrdCl::XRootDMsgHandler::SetRedirectAsAnswer ( bool  redirectAsAnswer  )  [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.

void XrdCl::XRootDMsgHandler::SetRedirectCounter ( uint16_t  redirectCounter  )  [inline]

Set the redirect counter.

References pRedirectCounter.

void XrdCl::XRootDMsgHandler::SetStateful ( bool  stateful  )  [inline]

References pStateful.

void XrdCl::XRootDMsgHandler::SwitchOnRefreshFlag (  )  [private]

Switch on the refresh flag for some requests.

void XrdCl::XRootDMsgHandler::TakeDownTimeoutFence (  ) 

Take down the timeout fence after oksofar response has been handled.

Status XrdCl::XRootDMsgHandler::UnPackReadVResponse ( Message msg  )  [private]

Unpack a single readv response.

void XrdCl::XRootDMsgHandler::UpdateTriedCGI ( uint32_t  errNo = 0  )  [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

Parameters:
now current timestamp
Status XrdCl::XRootDMsgHandler::WriteMessageBody ( int  socket,
uint32_t &  bytesRead 
) [virtual]

Write message body directly to a socket - called if IsRaw returns true - only socket related errors may be returned here

Parameters:
socket the socket to read from
bytesRead number of bytes read by the method
Returns:
stOK & suDone if the whole body has been processed stOK & suRetry if more data needs to be written stError on failure

Reimplemented from XrdCl::OutgoingMsgHandler.


Friends And Related Function Documentation

friend class HandleRspJob [friend]

Member Data Documentation

Referenced by GetMessageBody().

Referenced by SetChunkList().

Referenced by ~XRootDMsgHandler().

Referenced by SetExpiration().

Referenced by SetFollowMetalink().

Referenced by SetLoadBalancer().

Referenced by SetHostList(), and ~XRootDMsgHandler().

Referenced by ~XRootDMsgHandler().

Referenced by SetLoadBalancer().

Referenced by SetOksofarAsAnswer().

Referenced by ~XRootDMsgHandler().

Referenced by XRootDMsgHandler().

Referenced by SetRedirectAsAnswer().

Referenced by SetRedirectCounter().

Referenced by ~XRootDMsgHandler().

Referenced by ~XRootDMsgHandler().

Referenced by ~XRootDMsgHandler().

Referenced by SetStateful().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 9 Oct 2019 for xrootd by  doxygen 1.6.1