XRootD
Loading...
Searching...
No Matches
XrdClXRootDResponses.cc
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2011-2012 by European Organization for Nuclear Research (CERN)
3// Author: Lukasz Janyst <ljanyst@cern.ch>
4//------------------------------------------------------------------------------
5// XRootD is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// XRootD is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
17//------------------------------------------------------------------------------
18
20#include "XrdCl/XrdClLog.hh"
23#include "XrdCl/XrdClUtils.hh"
24#include <cstdlib>
25
26namespace XrdCl
27{
28 //----------------------------------------------------------------------------
29 // LocationInfo constructor
30 //----------------------------------------------------------------------------
34
35 //----------------------------------------------------------------------------
36 // Parse the server location response
37 //----------------------------------------------------------------------------
38 bool LocationInfo::ParseServerResponse( const char *data )
39 {
40 if( !data || strlen( data ) == 0 )
41 return false;
42
43 std::vector<std::string> locations;
44 std::vector<std::string>::iterator it;
45 Utils::splitString( locations, data, " " );
46 for( it = locations.begin(); it != locations.end(); ++it )
47 if( ProcessLocation( *it ) == false )
48 return false;
49 return true;
50 }
51
52 //----------------------------------------------------------------------------
53 // Process location
54 //----------------------------------------------------------------------------
55 bool LocationInfo::ProcessLocation( std::string &location )
56 {
57 if( location.length() < 5 )
58 return false;
59
60 //--------------------------------------------------------------------------
61 // Decode location type
62 //--------------------------------------------------------------------------
64 switch( location[0] )
65 {
66 case 'M':
68 break;
69 case 'm':
71 break;
72 case 'S':
74 break;
75 case 's':
77 break;
78 default:
79 return false;
80 }
81
82 //--------------------------------------------------------------------------
83 // Decode access type
84 //--------------------------------------------------------------------------
86 switch( location[1] )
87 {
88 case 'r':
90 break;
91 case 'w':
93 break;
94 default:
95 return false;
96 }
97
98 //--------------------------------------------------------------------------
99 // Push the location info
100 //--------------------------------------------------------------------------
101 pLocations.push_back( Location( location.substr(2), type, access ) );
102
103 return true;
104 }
105
106 //----------------------------------------------------------------------------
107 // StatInfo implementation
108 //----------------------------------------------------------------------------
110 {
111 StatInfoImpl() : pSize( 0 ), pFlags( 0 ), pModifyTime( 0 ),
112 pChangeTime( 0 ), pAccessTime( 0 ),
113 pExtended( false ), pHasCksum( false )
114 {
115 }
116
117 StatInfoImpl( const StatInfoImpl & pimpl ) : pId( pimpl.pId ),
118 pSize( pimpl.pSize ),
119 pFlags( pimpl.pFlags ),
120 pModifyTime( pimpl.pModifyTime ),
121 pChangeTime( pimpl.pChangeTime ),
122 pAccessTime( pimpl.pAccessTime ),
123 pMode( pimpl.pMode ),
124 pOwner( pimpl.pOwner ),
125 pGroup( pimpl.pGroup ),
126 pExtended( pimpl.pExtended ),
127 pHasCksum( pimpl.pHasCksum )
128 {
129 }
130
131 //------------------------------------------------------------------------
132 // Parse the stat info returned by the server
133 //------------------------------------------------------------------------
134 bool ParseServerResponse( const char *data )
135 {
136 if( !data || strlen( data ) == 0 )
137 return false;
138
139 std::vector<std::string> chunks;
140 Utils::splitString( chunks, data, " " );
141
142 if( chunks.size() < 4 )
143 return false;
144
145 pId = chunks[0];
146
147 char *result;
148 pSize = ::strtoll( chunks[1].c_str(), &result, 0 );
149 if( *result != 0 )
150 {
151 pSize = 0;
152 return false;
153 }
154
155 pFlags = ::strtol( chunks[2].c_str(), &result, 0 );
156 if( *result != 0 )
157 {
158 pFlags = 0;
159 return false;
160 }
161
162 pModifyTime = ::strtoll( chunks[3].c_str(), &result, 0 );
163 if( *result != 0 )
164 {
165 pModifyTime = 0;
166 return false;
167 }
168
169 if( chunks.size() >= 9 )
170 {
171 pChangeTime = ::strtoll( chunks[4].c_str(), &result, 0 );
172 if( *result != 0 )
173 {
174 pChangeTime = 0;
175 return false;
176 }
177
178 pAccessTime = ::strtoll( chunks[5].c_str(), &result, 0 );
179 if( *result != 0 )
180 {
181 pAccessTime = 0;
182 return false;
183 }
184
185 // we are expecting at least 4 characters, e.g.: 0644
186 if( chunks[6].size() < 4 ) return false;
187 pMode = chunks[6];
188
189 pOwner = chunks[7];
190 pGroup = chunks[8];
191
192 pExtended = true;
193 }
194
195 // after the extended stat information, we might have the checksum
196 if( chunks.size() >= 10 )
197 {
198 if( ( chunks[9] == "[" ) && ( chunks[11] == "]" ) )
199 {
200 pHasCksum = true;
201 pCksum = chunks[10];
202 }
203 }
204
205 return true;
206 }
207
208 std::string pId;
209 uint64_t pSize;
210 uint32_t pFlags;
211 uint64_t pModifyTime;
212 uint64_t pChangeTime;
213 uint64_t pAccessTime;
214 std::string pMode;
215 std::string pOwner;
216 std::string pGroup;
217
220 std::string pCksum;
221 };
222
223 //----------------------------------------------------------------------------
224 // StatInfo constructor
225 //----------------------------------------------------------------------------
227 {
228 }
229
230 //------------------------------------------------------------------------
231 // Constructor
232 //------------------------------------------------------------------------
233 StatInfo::StatInfo( const std::string &id, uint64_t size, uint32_t flags,
234 uint64_t modTime ) : pImpl( new StatInfoImpl() )
235
236 {
237 pImpl->pId = id;
238 pImpl->pSize = size;
239 pImpl->pFlags = flags;
240 pImpl->pModifyTime = modTime;
241 }
242
243 //------------------------------------------------------------------------
244 // Copy constructor
245 //------------------------------------------------------------------------
246 StatInfo::StatInfo( const StatInfo &info ) : pImpl( new StatInfoImpl( *info.pImpl) )
247 {
248 }
249
250 //------------------------------------------------------------------------
251 // Destructor (it can be only defined after StatInfoImpl is defined!!!)
252 //------------------------------------------------------------------------
253 StatInfo::~StatInfo() = default;
254
255 //----------------------------------------------------------------------------
256 // Parse the stat info returned by the server
257 //----------------------------------------------------------------------------
258 bool StatInfo::ParseServerResponse( const char *data )
259 {
260 return pImpl->ParseServerResponse( data );
261 }
262
263 //------------------------------------------------------------------------
265 //------------------------------------------------------------------------
266 const std::string& StatInfo::GetId() const
267 {
268 return pImpl->pId;
269 }
270
271 //------------------------------------------------------------------------
273 //------------------------------------------------------------------------
274 uint64_t StatInfo::GetSize() const
275 {
276 return pImpl->pSize;
277 }
278
279 //------------------------------------------------------------------------
281 //------------------------------------------------------------------------
282 void StatInfo::SetSize( uint64_t size )
283 {
284 pImpl->pSize = size;
285 }
286
287 //------------------------------------------------------------------------
289 //------------------------------------------------------------------------
290 uint32_t StatInfo::GetFlags() const
291 {
292 return pImpl->pFlags;
293 }
294
295 //------------------------------------------------------------------------
297 //------------------------------------------------------------------------
298 void StatInfo::SetFlags( uint32_t flags )
299 {
300 pImpl->pFlags = flags;
301 }
302
303 //------------------------------------------------------------------------
305 //------------------------------------------------------------------------
306 bool StatInfo::TestFlags( uint32_t flags ) const
307 {
308 return pImpl->pFlags & flags;
309 }
310
311 //------------------------------------------------------------------------
313 //------------------------------------------------------------------------
314 uint64_t StatInfo::GetModTime() const
315 {
316 return pImpl->pModifyTime;
317 }
318
319 //------------------------------------------------------------------------
321 //------------------------------------------------------------------------
323 {
324 return TimeToString( pImpl->pModifyTime );
325 }
326
327 //------------------------------------------------------------------------
329 //------------------------------------------------------------------------
330 uint64_t StatInfo::GetChangeTime() const
331 {
332 return pImpl->pChangeTime;
333 }
334
335 //------------------------------------------------------------------------
337 //------------------------------------------------------------------------
339 {
340 return TimeToString( pImpl->pChangeTime );
341 }
342
343 //------------------------------------------------------------------------
345 //------------------------------------------------------------------------
346 uint64_t StatInfo::GetAccessTime() const
347 {
348 return pImpl->pAccessTime;
349 }
350
351 //------------------------------------------------------------------------
353 //------------------------------------------------------------------------
355 {
356 return TimeToString( pImpl->pAccessTime );
357 }
358
359 //------------------------------------------------------------------------
361 //------------------------------------------------------------------------
362 const std::string& StatInfo::GetModeAsString() const
363 {
364 return pImpl->pMode;
365 }
366
367 //------------------------------------------------------------------------
369 //------------------------------------------------------------------------
370 const std::string StatInfo::GetModeAsOctString() const
371 {
372 std::string ret;
373 ret.reserve( 9 );
374
375 // we care about 3 last digits
376 size_t size = pImpl->pMode.size();
377
378 // to have meaningful pMode we need to have parsed
379 // the extended format. In that case pMode should be
380 // at least 4 digits, but we also check the size.
381 if( !ExtendedFormat() || size < 3 )
382 return "---------";
383
384 uint8_t oct = pImpl->pMode[size - 3] - '0';
385 OctToString( oct, ret );
386
387 oct = pImpl->pMode[size - 2] - '0';
388 OctToString( oct, ret );
389
390 oct = pImpl->pMode[size - 1] - '0';
391 OctToString( oct, ret );
392
393 return ret;
394 }
395
396 //------------------------------------------------------------------------
398 //------------------------------------------------------------------------
399 const std::string& StatInfo::GetOwner() const
400 {
401 return pImpl->pOwner;
402 }
403
404 //------------------------------------------------------------------------
406 //------------------------------------------------------------------------
407 const std::string& StatInfo::GetGroup() const
408 {
409 return pImpl->pGroup;
410 }
411
412 //------------------------------------------------------------------------
414 //------------------------------------------------------------------------
415 const std::string& StatInfo::GetChecksum() const
416 {
417 return pImpl->pCksum;
418 }
419
420 //------------------------------------------------------------------------
422 //------------------------------------------------------------------------
424 {
425 return pImpl->pExtended;
426 }
427
428 //------------------------------------------------------------------------
430 //------------------------------------------------------------------------
432 {
433 return pImpl->pHasCksum;
434 }
435
436 //----------------------------------------------------------------------------
437 // StatInfo constructor
438 //----------------------------------------------------------------------------
440 pNodesRW( 0 ),
441 pFreeRW( 0 ),
442 pUtilizationRW( 0 ),
443 pNodesStaging( 0 ),
444 pFreeStaging( 0 ),
445 pUtilizationStaging( 0 )
446 {
447 }
448
449 //----------------------------------------------------------------------------
450 // Parse the stat info returned by the server
451 //----------------------------------------------------------------------------
452 bool StatInfoVFS::ParseServerResponse( const char *data )
453 {
454 if( !data || strlen( data ) == 0 )
455 return false;
456
457 std::vector<std::string> chunks;
458 Utils::splitString( chunks, data, " " );
459
460 if( chunks.size() < 6 )
461 return false;
462
463 char *result;
464 pNodesRW = ::strtoll( chunks[0].c_str(), &result, 0 );
465 if( *result != 0 )
466 {
467 pNodesRW = 0;
468 return false;
469 }
470
471 pFreeRW = ::strtoll( chunks[1].c_str(), &result, 0 );
472 if( *result != 0 )
473 {
474 pFreeRW = 0;
475 return false;
476 }
477
478 pUtilizationRW = ::strtol( chunks[2].c_str(), &result, 0 );
479 if( *result != 0 )
480 {
481 pUtilizationRW = 0;
482 return false;
483 }
484
485 pNodesStaging = ::strtoll( chunks[3].c_str(), &result, 0 );
486 if( *result != 0 )
487 {
488 pNodesStaging = 0;
489 return false;
490 }
491
492 pFreeStaging = ::strtoll( chunks[4].c_str(), &result, 0 );
493 if( *result != 0 )
494 {
495 pFreeStaging = 0;
496 return false;
497 }
498
499 pUtilizationStaging = ::strtol( chunks[5].c_str(), &result, 0 );
500 if( *result != 0 )
501 {
502 pUtilizationStaging = 0;
503 return false;
504 }
505
506 return true;
507 }
508
509 const std::string DirectoryList::dStatPrefix = ".\n0 0 0 0";
510
511 //----------------------------------------------------------------------------
512 // DirectoryList constructor
513 //----------------------------------------------------------------------------
517
518 //----------------------------------------------------------------------------
519 // Destructor
520 //----------------------------------------------------------------------------
522 {
523 for( Iterator it = pDirList.begin(); it != pDirList.end(); ++it )
524 delete *it;
525 }
526
527 //----------------------------------------------------------------------------
528 // Parse the directory list
529 //----------------------------------------------------------------------------
530 bool DirectoryList::ParseServerResponse( const std::string &hostId,
531 const char *data )
532 {
533 if( !data )
534 return false;
535
536 //--------------------------------------------------------------------------
537 // Check what kind of response we're dealing with
538 //--------------------------------------------------------------------------
539 bool isDStat = HasStatInfo( data );
540 if( isDStat )
541 data += dStatPrefix.size();
542 return ParseServerResponse( hostId, data, isDStat );
543 }
544
545 //------------------------------------------------------------------------
547 //------------------------------------------------------------------------
548 bool DirectoryList::ParseServerResponse( const std::string &hostId,
549 const char *data,
550 bool isDStat )
551 {
552 if( !data )
553 return false;
554
555 std::string dat = data;
556 std::vector<std::string> entries;
557 std::vector<std::string>::iterator it;
558 Utils::splitString( entries, dat, "\n" );
559
560 //--------------------------------------------------------------------------
561 // Normal response
562 //--------------------------------------------------------------------------
563 if( !isDStat )
564 {
565 for( it = entries.begin(); it != entries.end(); ++it )
566 Add( new ListEntry( hostId, *it ) );
567 return true;
568 }
569
570 //--------------------------------------------------------------------------
571 // kXR_dstat
572 //--------------------------------------------------------------------------
573 if( entries.size() % 2 )
574 return false;
575
576 it = entries.begin(); //++it; ++it;
577 for( ; it != entries.end(); ++it )
578 {
579 ListEntry *entry = new ListEntry( hostId, *it );
580 Add( entry );
581 ++it;
582 StatInfo *i = new StatInfo();
583 entry->SetStatInfo( i );
584 bool ok = i->ParseServerResponse( it->c_str() );
585 if( !ok )
586 return false;
587 }
588 return true;
589 }
590
591 //------------------------------------------------------------------------
592 // Returns true if data contain stat info
593 //------------------------------------------------------------------------
594 bool DirectoryList::HasStatInfo( const char *data )
595 {
596 std::string dat = data;
597 return !dat.compare( 0, dStatPrefix.size(), dStatPrefix );
598 }
599
601 {
602 PageInfoImpl( uint64_t offset = 0, uint32_t length = 0, void *buffer = 0,
603 std::vector<uint32_t> &&cksums = std::vector<uint32_t>() ) :
604 offset( offset ),
605 length( length ),
606 buffer( buffer ),
607 cksums( std::move( cksums ) ),
608 nbrepair( 0 )
609 {
610 }
611
612 PageInfoImpl( PageInfoImpl &&pginf ) : offset( pginf.offset ),
613 length( pginf.length ),
614 buffer( pginf.buffer ),
615 cksums( std::move( pginf.cksums ) ),
616 nbrepair( pginf.nbrepair )
617 {
618 }
619
620 uint64_t offset; //> offset in the file
621 uint32_t length; //> length of the data read
622 void *buffer; //> buffer with the read data
623 std::vector<uint32_t> cksums; //> a vector of crc32c checksums
624 size_t nbrepair; //> number of repaired pages
625 };
626
627 //----------------------------------------------------------------------------
628 // Default constructor
629 //----------------------------------------------------------------------------
630 PageInfo::PageInfo( uint64_t offset, uint32_t length, void *buffer,
631 std::vector<uint32_t> &&cksums ) :
632 pImpl( new PageInfoImpl( offset, length, buffer, std::move( cksums ) ) )
633 {
634 }
635
636 //----------------------------------------------------------------------------
637 // Move constructor
638 //----------------------------------------------------------------------------
639 PageInfo::PageInfo( PageInfo &&pginf ) : pImpl( std::move( pginf.pImpl ) )
640 {
641 }
642
643 //----------------------------------------------------------------------------
645 //----------------------------------------------------------------------------
647 {
648 pImpl.swap( pginf.pImpl );
649 return *this;
650 }
651
652 //----------------------------------------------------------------------------
653 // Destructor
654 //----------------------------------------------------------------------------
656 {
657 }
658
659 //----------------------------------------------------------------------------
660 // Get the offset
661 //----------------------------------------------------------------------------
662 uint64_t PageInfo::GetOffset() const
663 {
664 return pImpl->offset;
665 }
666
667 //----------------------------------------------------------------------------
668 // Get the data length
669 //----------------------------------------------------------------------------
670 uint32_t PageInfo::GetLength() const
671 {
672 return pImpl->length;
673 }
674
675 //----------------------------------------------------------------------------
676 // Get the buffer
677 //----------------------------------------------------------------------------
679 {
680 return pImpl->buffer;
681 }
682
683 //----------------------------------------------------------------------------
684 // Get the buffer
685 //----------------------------------------------------------------------------
686 std::vector<uint32_t>& PageInfo::GetCksums()
687 {
688 return pImpl->cksums;
689 }
690
691 //----------------------------------------------------------------------------
692 // Set number of repaired pages
693 //----------------------------------------------------------------------------
694 void PageInfo::SetNbRepair( size_t nbrepair )
695 {
696 pImpl->nbrepair = nbrepair;
697 }
698
699 //----------------------------------------------------------------------------
700 // Get number of repaired pages
701 //----------------------------------------------------------------------------
703 {
704 return pImpl->nbrepair;
705 }
706
708 {
709 RetryInfoImpl( std::vector<std::tuple<uint64_t, uint32_t>> && retries ) :
710 retries( std::move( retries ) )
711 {
712
713 }
714
715 std::vector<std::tuple<uint64_t, uint32_t>> retries;
716 };
717
718 //----------------------------------------------------------------------------
719 // Constructor
720 //----------------------------------------------------------------------------
721 RetryInfo::RetryInfo( std::vector<std::tuple<uint64_t, uint32_t>> && retries ) :
722 pImpl( new RetryInfoImpl( std::move( retries ) ) )
723 {
724
725 }
726
727 //----------------------------------------------------------------------------
728 // Destructor
729 //----------------------------------------------------------------------------
731
732 //----------------------------------------------------------------------------
733 // @return : true if some pages need retrying, false otherwise
734 //----------------------------------------------------------------------------
736 {
737 return !pImpl->retries.empty();
738 }
739
740 //----------------------------------------------------------------------------
741 // @return number of pages that need to be retransmitted
742 //----------------------------------------------------------------------------
744 {
745 return pImpl->retries.size();
746 }
747
748 //----------------------------------------------------------------------------
749 // @return : offset and size of respective page that requires to be
750 // retransmitted
751 //----------------------------------------------------------------------------
752 std::tuple<uint64_t, uint32_t> RetryInfo::At( size_t i )
753 {
754 return pImpl->retries[i];
755 }
756
757 //------------------------------------------------------------------------
758 // Factory function for generating handler objects from lambdas
759 //------------------------------------------------------------------------
761 {
762 struct FuncHandler : public ResponseHandler
763 {
764 FuncHandler( std::function<void(XRootDStatus&, AnyObject&)> func ) : func( std::move( func ) )
765 {
766 }
767
768 void HandleResponse( XRootDStatus *status, AnyObject *response )
769 {
770 // make sure the arguments will be released
771 std::unique_ptr<XRootDStatus> stptr( status );
772 std::unique_ptr<AnyObject> rspptr( response );
773 // if there is no response provide a null reference placeholder
774 static AnyObject nullref;
775 if( response == nullptr )
776 response = &nullref;
777 // call the user completion handler
778 func( *status, *response );
779 // check if this is a final respons
780 bool finalrsp = !( status->IsOK() && status->code == suContinue );
781 // deallocate the wrapper if final
782 if( finalrsp )
783 delete this;
784 }
785
786 std::function<void(XRootDStatus&, AnyObject&)> func;
787 };
788
789 return new FuncHandler( func );
790 }
791
793 {
794 struct FuncHandler : public ResponseHandler
795 {
796 FuncHandler( std::function<void(XRootDStatus*, AnyObject*)> func ) : func( std::move( func ) )
797 {
798 }
799
800 void HandleResponse( XRootDStatus *status, AnyObject *response )
801 {
802 // check if this is a final respons
803 bool finalrsp = !( status->IsOK() && status->code == suContinue );
804 // call the user completion handler
805 func( status, response );
806 // deallocate the wrapper if final
807 if( finalrsp )
808 delete this;
809 }
810
811 std::function<void(XRootDStatus*, AnyObject*)> func;
812 };
813
814 return new FuncHandler( func );
815 }
816}
#define access(a, b)
Definition XrdPosix.hh:44
void SetStatInfo(StatInfo *info)
Set the stat info object (and transfer the ownership).
void Add(ListEntry *entry)
Add an entry to the list - takes ownership.
DirList::iterator Iterator
Directory listing iterator.
static bool HasStatInfo(const char *data)
Returns true if data contain stat info.
virtual ~DirectoryList()
Destructor.
bool ParseServerResponse(const std::string &hostId, const char *data)
Parse server response and fill up the object.
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
AccessType
Describes the allowed access type for the file at given location.
@ Read
read access is allowed
@ ReadWrite
write access is allowed
LocationType
Describes the node type and file status for a given location.
@ ServerPending
server node where the file is pending to be online
@ ManagerOnline
manager node where the file is online
@ ServerOnline
server node where the file is online
@ ManagerPending
manager node where the file is pending to be online
Handle an async response.
static ResponseHandler * Wrap(std::function< void(XRootDStatus &, AnyObject &)> func)
virtual void HandleResponse(XRootDStatus *status, AnyObject *response)
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
Object stat info.
uint64_t GetChangeTime() const
Get change time (in seconds since epoch).
std::string GetChangeTimeAsString() const
Get change time.
std::string GetModTimeAsString() const
Get modification time.
bool HasChecksum() const
Has checksum.
bool TestFlags(uint32_t flags) const
Test flags.
uint64_t GetSize() const
Get size (in bytes).
const std::string GetModeAsOctString() const
Get mode.
virtual ~StatInfo()
Destructor.
const std::string & GetOwner() const
Get owner.
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
uint32_t GetFlags() const
Get flags.
bool ExtendedFormat() const
Has extended stat information.
const std::string & GetModeAsString() const
Get mode.
const std::string & GetId() const
Get id.
const std::string & GetGroup() const
Get group.
uint64_t GetModTime() const
Get modification time (in seconds since epoch).
std::string GetAccessTimeAsString() const
Get change time.
void SetSize(uint64_t size)
Set size.
uint64_t GetAccessTime() const
Get change time (in seconds since epoch).
void SetFlags(uint32_t flags)
Set flags.
const std::string & GetChecksum() const
Get checksum.
static void splitString(Container &result, const std::string &input, const std::string &delimiter)
Split a string.
Definition XrdClUtils.hh:56
const uint16_t suContinue
PageInfoImpl(uint64_t offset=0, uint32_t length=0, void *buffer=0, std::vector< uint32_t > &&cksums=std::vector< uint32_t >())
std::vector< uint32_t > cksums
PageInfoImpl(PageInfoImpl &&pginf)
size_t GetNbRepair()
Get number of repaired pages.
void SetNbRepair(size_t nbrepair)
Set number of repaired pages.
virtual ~PageInfo()
Destructor.
PageInfo(uint64_t offset=0, uint32_t length=0, void *buffer=0, std::vector< uint32_t > &&cksums=std::vector< uint32_t >())
Default constructor.
PageInfo & operator=(PageInfo &&pginf)
Move assigment operator.
std::vector< uint32_t > & GetCksums()
Get the checksums.
uint32_t GetLength() const
Get the data length.
uint64_t GetOffset() const
Get the offset.
void * GetBuffer()
Get the buffer.
std::vector< std::tuple< uint64_t, uint32_t > > retries
RetryInfoImpl(std::vector< std::tuple< uint64_t, uint32_t > > &&retries)
RetryInfo(std::vector< std::tuple< uint64_t, uint32_t > > &&retries)
Constructor.
std::tuple< uint64_t, uint32_t > At(size_t i)
virtual ~RetryInfo()
Destructor.
bool ParseServerResponse(const char *data)
StatInfoImpl(const StatInfoImpl &pimpl)
uint16_t code
Error type, or additional hints on what to do.
bool IsOK() const
We're fine.