Loading...
Searching...
No Matches
XrdCl::AsyncPageReader Class Reference

Object for reading out data from the PgRead response. More...

`#include <XrdClAsyncPageReader.hh>`

Collaboration diagram for XrdCl::AsyncPageReader:

## Public Member Functions

| AsyncPageReader (ChunkList &chunks, std::vector< uint32_t > &digests)
virtual | ~AsyncPageReader ()
| Destructor.
XRootDStatus | Read (Socket &socket, uint32_t &btsread)
void | SetRsp (ServerResponseV2 *rsp)
| Sets message data size.

## Detailed Description

Object for reading out data from the PgRead response.

Definition at line 37 of file XrdClAsyncPageReader.hh.

## Constructor & Destructor Documentation

## AsyncPageReader()

XrdCl::AsyncPageReader::AsyncPageReader | ( | ChunkList & | chunks,
|  | std::vector< uint32_t > & | digests )

inline

Constructor

Parameters

  chunks | : list of buffer for the data
  digests | : a vector that will be filled with crc32c digest data

Definition at line 47 of file XrdClAsyncPageReader.hh.

:
chunks( chunks ),
digests( digests ),
dlen( 0 ),
rspoff( 0 ),
chindex( 0 ),
choff( 0 ),
dgindex( 0 ),
dgoff( 0 ),
iovcnt( 0 ),
iovindex( 0 )
{
uint64_t rdoff = chunks.front().offset;
uint32_t rdlen = 0;
for( auto &ch : chunks )
rdlen += ch.length;
int fpglen, lpglen;
int pgcnt = XrdOucPgrwUtils::csNum( rdoff, rdlen, fpglen, lpglen);
digests.resize( pgcnt );
}
XrdOucPgrwUtils::csNum
static int csNum(off_t offs, int count)
Compute the required size of a checksum vector based on offset & length.
Definition XrdOucPgrwUtils.cc:109

References XrdOucPgrwUtils::csNum().

Here is the call graph for this function:

## ~AsyncPageReader()

virtual XrdCl::AsyncPageReader::~AsyncPageReader | ( |  | ) |

inline virtual

Destructor.

Definition at line 72 of file XrdClAsyncPageReader.hh.

{
}

## Member Function Documentation

## Read()

XRootDStatus XrdCl::AsyncPageReader::Read | ( | Socket & | socket,
|  | uint32_t & | btsread )

inline

Readout data from the socket

Parameters

  socket | : the socket with the data
  btsread | : number of user data read from the socket

Returns
  : operation status

Definition at line 105 of file XrdClAsyncPageReader.hh.

{
if( dlen == 0 || chindex >= chunks.size() )
return XRootDStatus();
btsread = 0;
int nbbts = 0;
do
{
// Prepare the IO vector for receiving the data
if( iov.empty() )
InitIOV();
// read the data into the buffer
nbbts = 0;
auto st = socket.ReadV( iov.data() + iovindex, iovcnt, nbbts );
if( !st.IsOK() )
return st;
btsread += nbbts;
dlen -= nbbts;
ShiftIOV( nbbts );
if( st.code == suRetry )
return st;
}
while( nbbts > 0 && dlen > 0 && chindex < chunks.size() );
return XRootDStatus();
}
XrdCl::suRetry
const uint16_t suRetry
Definition XrdClStatus.hh:40

References XrdCl::Socket::ReadV(), and XrdCl::suRetry.

Here is the call graph for this function:

## SetRsp()

void XrdCl::AsyncPageReader::SetRsp | ( | ServerResponseV2 * | rsp | ) |

inline

Sets message data size.

Definition at line 79 of file XrdClAsyncPageReader.hh.

{
dlen = rsp->status.bdy.dlen;
rspoff = rsp->info.pgread.offset;
uint64_t bufoff = rspoff - chunks[0].offset;
chindex = 0;
for( chindex = 0; chindex < chunks.size(); ++chindex )
{
if( chunks[chindex].length < bufoff )
{
bufoff -= chunks[chindex].length;
continue;
}
break;
}
choff = bufoff;
}
ServerResponseV2::status
ServerResponseStatus status
Definition XProtocol.hh:1310
ServerResponseStatus::bdy
struct ServerResponseBody_Status bdy
Definition XProtocol.hh:1262
ServerResponseV2::info
union ServerResponseV2::@207342300141235315373173036347114307032363217365 info
ServerResponseBody_Status::dlen
kXR_int32 dlen
Definition XProtocol.hh:1241

References ServerResponseStatus::bdy, ServerResponseBody_Status::dlen, ServerResponseV2::info, and ServerResponseV2::status.

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

- XrdClAsyncPageReader.hh