XRootD
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.

48 :
49 chunks( chunks ),
50 digests( digests ),
51 dlen( 0 ),
52 rspoff( 0 ),
53 chindex( 0 ),
54 choff( 0 ),
55 dgindex( 0 ),
56 dgoff( 0 ),
57 iovcnt( 0 ),
58 iovindex( 0 )
59 {
60 uint64_t rdoff = chunks.front().offset;
61 uint32_t rdlen = 0;
62 for( auto &ch : chunks )
63 rdlen += ch.length;
64 int fpglen, lpglen;
65 int pgcnt = XrdOucPgrwUtils::csNum( rdoff, rdlen, fpglen, lpglen);
66 digests.resize( pgcnt );
67 }
static int csNum(off_t offs, int count)
Compute the required size of a checksum vector based on offset & length.

References XrdOucPgrwUtils::csNum().

+ Here is the call graph for this function:

◆ ~AsyncPageReader()

virtual XrdCl::AsyncPageReader::~AsyncPageReader ( )
inlinevirtual

Destructor.

Definition at line 72 of file XrdClAsyncPageReader.hh.

73 {
74 }

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.

106 {
107 if( dlen == 0 || chindex >= chunks.size() )
108 return XRootDStatus();
109 btsread = 0;
110 int nbbts = 0;
111 do
112 {
113 // Prepare the IO vector for receiving the data
114 if( iov.empty() )
115 InitIOV();
116 // read the data into the buffer
117 nbbts = 0;
118 auto st = socket.ReadV( iov.data() + iovindex, iovcnt, nbbts );
119 if( !st.IsOK() )
120 return st;
121 btsread += nbbts;
122 dlen -= nbbts;
123 ShiftIOV( nbbts );
124 if( st.code == suRetry )
125 return st;
126 }
127 while( nbbts > 0 && dlen > 0 && chindex < chunks.size() );
128
129 return XRootDStatus();
130 }
const uint16_t suRetry

References XrdOucIOVec::data, 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.

80 {
81 dlen = rsp->status.bdy.dlen;
82 rspoff = rsp->info.pgread.offset;
83
84 uint64_t bufoff = rspoff - chunks[0].offset;
85 chindex = 0;
86
87 for( chindex = 0; chindex < chunks.size(); ++chindex )
88 {
89 if( chunks[chindex].length < bufoff )
90 {
91 bufoff -= chunks[chindex].length;
92 continue;
93 }
94 break;
95 }
96 choff = bufoff;
97 }
ServerResponseStatus status
struct ServerResponseBody_Status bdy
union ServerResponseV2::@19 info

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


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