XRootD
XrdCl::AsyncRawReaderIntfc Class Referenceabstract

Base class for any message's body reader. More...

#include <XrdClAsyncRawReaderIntfc.hh>

+ Inheritance diagram for XrdCl::AsyncRawReaderIntfc:
+ Collaboration diagram for XrdCl::AsyncRawReaderIntfc:

Classes

struct  ChunkStatus
 

Public Member Functions

 AsyncRawReaderIntfc (const URL &url, const Message &request)
 
virtual ~AsyncRawReaderIntfc ()
 Destructor. More...
 
virtual XRootDStatus GetResponse (AnyObject *&response)=0
 Get the response. More...
 
virtual XRootDStatus Read (Socket &socket, uint32_t &btsret)=0
 
void SetChunkList (ChunkList *chunks)
 Sets the chunk list with user buffers. More...
 
void SetDataLength (int dlen)
 Sets response data length. More...
 

Protected Types

using buffer_t = std::vector< char >
 
enum  Stage {
  ReadStart ,
  ReadRdLst ,
  ReadRaw ,
  ReadDiscard ,
  ReadDone
}
 Stages of reading out a response from the socket. More...
 

Protected Member Functions

XRootDStatus ReadBytesAsync (Socket &socket, char *buffer, uint32_t toBeRead, uint32_t &bytesRead)
 

Protected Attributes

size_t chidx
 
size_t chlen
 
size_t choff
 
std::vector< ChunkStatuschstatus
 
ChunkListchunks
 
bool dataerr
 
buffer_t discardbuff
 
uint32_t dlen
 
uint32_t msgbtsrd
 
uint32_t rawbtsrd
 
Stage readstage
 
const Messagerequest
 
const URLurl
 

Detailed Description

Base class for any message's body reader.

Definition at line 34 of file XrdClAsyncRawReaderIntfc.hh.

Member Typedef Documentation

◆ buffer_t

using XrdCl::AsyncRawReaderIntfc::buffer_t = std::vector<char>
protected

Definition at line 132 of file XrdClAsyncRawReaderIntfc.hh.

Member Enumeration Documentation

◆ Stage

Stages of reading out a response from the socket.

Enumerator
ReadStart 
ReadRdLst 
ReadRaw 
ReadDiscard 
ReadDone 

Definition at line 137 of file XrdClAsyncRawReaderIntfc.hh.

138  {
139  ReadStart, //< the next step is to initialize the read
140  ReadRdLst, //< the next step is to read the read_list
141  ReadRaw, //< the next step is to read the raw data
142  ReadDiscard, //< there was an error, we are in discard mode
143  ReadDone //< the next step is to finalize the read
144  };

Constructor & Destructor Documentation

◆ AsyncRawReaderIntfc()

XrdCl::AsyncRawReaderIntfc::AsyncRawReaderIntfc ( const URL url,
const Message request 
)
inline

◆ ~AsyncRawReaderIntfc()

virtual XrdCl::AsyncRawReaderIntfc::~AsyncRawReaderIntfc ( )
inlinevirtual

Destructor.

Definition at line 56 of file XrdClAsyncRawReaderIntfc.hh.

57  {
58  }

Member Function Documentation

◆ GetResponse()

virtual XRootDStatus XrdCl::AsyncRawReaderIntfc::GetResponse ( AnyObject *&  response)
pure virtual

◆ Read()

virtual XRootDStatus XrdCl::AsyncRawReaderIntfc::Read ( Socket socket,
uint32_t &  btsret 
)
pure virtual

Readout raw data from socket

Parameters
socket: the socket
btsret: number of bytes read
Returns
: operation status

Implemented in XrdCl::AsyncVectorReader, XrdCl::AsyncRawReader, and XrdCl::AsyncDiscardReader.

◆ ReadBytesAsync()

XRootDStatus XrdCl::AsyncRawReaderIntfc::ReadBytesAsync ( Socket socket,
char *  buffer,
uint32_t  toBeRead,
uint32_t &  bytesRead 
)
inlineprotected

Definition at line 98 of file XrdClAsyncRawReaderIntfc.hh.

102  {
103  size_t shift = 0;
104  while( toBeRead > 0 )
105  {
106  int btsRead = 0;
107  Status status = socket.Read( buffer + shift, toBeRead, btsRead );
108 
109  if( !status.IsOK() || status.code == suRetry )
110  return status;
111 
112  bytesRead += btsRead;
113  toBeRead -= btsRead;
114  shift += btsRead;
115  }
116  return XRootDStatus( stOK, suDone );
117  }
const uint16_t suRetry
Definition: XrdClStatus.hh:40
const uint16_t stOK
Everything went OK.
Definition: XrdClStatus.hh:31
const uint16_t suDone
Definition: XrdClStatus.hh:38

References XrdCl::Status::code, XrdCl::Status::IsOK(), XrdCl::Socket::Read(), XrdCl::stOK, XrdCl::suDone, and XrdCl::suRetry.

Referenced by XrdCl::AsyncRawReader::Read(), and XrdCl::AsyncVectorReader::Read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetChunkList()

void XrdCl::AsyncRawReaderIntfc::SetChunkList ( ChunkList chunks)
inline

Sets the chunk list with user buffers.

Definition at line 72 of file XrdClAsyncRawReaderIntfc.hh.

73  {
74  this->chunks = chunks;
75  if( chunks )
76  this->chstatus.resize( chunks->size() );
77  }
std::vector< ChunkStatus > chstatus

References chstatus, and chunks.

◆ SetDataLength()

void XrdCl::AsyncRawReaderIntfc::SetDataLength ( int  dlen)
inline

Sets response data length.

Definition at line 63 of file XrdClAsyncRawReaderIntfc.hh.

64  {
65  this->dlen = dlen;
66  this->readstage = ReadStart;
67  }

References dlen, readstage, and ReadStart.

Member Data Documentation

◆ chidx

size_t XrdCl::AsyncRawReaderIntfc::chidx
protected

◆ chlen

size_t XrdCl::AsyncRawReaderIntfc::chlen
protected

◆ choff

size_t XrdCl::AsyncRawReaderIntfc::choff
protected

◆ chstatus

std::vector<ChunkStatus> XrdCl::AsyncRawReaderIntfc::chstatus
protected

◆ chunks

ChunkList* XrdCl::AsyncRawReaderIntfc::chunks
protected

◆ dataerr

bool XrdCl::AsyncRawReaderIntfc::dataerr
protected

Definition at line 168 of file XrdClAsyncRawReaderIntfc.hh.

Referenced by XrdCl::AsyncRawReader::GetResponse().

◆ discardbuff

buffer_t XrdCl::AsyncRawReaderIntfc::discardbuff
protected

Definition at line 167 of file XrdClAsyncRawReaderIntfc.hh.

◆ dlen

uint32_t XrdCl::AsyncRawReaderIntfc::dlen
protected

◆ msgbtsrd

uint32_t XrdCl::AsyncRawReaderIntfc::msgbtsrd
protected

◆ rawbtsrd

uint32_t XrdCl::AsyncRawReaderIntfc::rawbtsrd
protected

◆ readstage

Stage XrdCl::AsyncRawReaderIntfc::readstage
protected

◆ request

const Message& XrdCl::AsyncRawReaderIntfc::request
protected

◆ url

const URL& XrdCl::AsyncRawReaderIntfc::url
protected

The documentation for this class was generated from the following file: