40 if( !data || strlen( data ) == 0 )
43 std::vector<std::string> locations;
44 std::vector<std::string>::iterator it;
46 for( it = locations.begin(); it != locations.end(); ++it )
47 if( ProcessLocation( *it ) ==
false )
55 bool LocationInfo::ProcessLocation( std::string &location )
57 if( location.length() < 5 )
101 pLocations.push_back( Location( location.substr(2), type,
access ) );
136 if( !data || strlen( data ) == 0 )
139 std::vector<std::string> chunks;
142 if( chunks.size() < 4 )
148 pSize = ::strtoll( chunks[1].c_str(), &result, 0 );
155 pFlags = ::strtol( chunks[2].c_str(), &result, 0 );
162 pModifyTime = ::strtoll( chunks[3].c_str(), &result, 0 );
169 if( chunks.size() >= 9 )
171 pChangeTime = ::strtoll( chunks[4].c_str(), &result, 0 );
178 pAccessTime = ::strtoll( chunks[5].c_str(), &result, 0 );
186 if( chunks[6].size() < 4 )
return false;
196 if( chunks.size() >= 10 )
198 if( ( chunks[9] ==
"[" ) && ( chunks[11] ==
"]" ) )
239 pImpl->pFlags = flags;
240 pImpl->pModifyTime = modTime;
260 return pImpl->ParseServerResponse( data );
292 return pImpl->pFlags;
300 pImpl->pFlags = flags;
308 return pImpl->pFlags & flags;
316 return pImpl->pModifyTime;
324 return TimeToString( pImpl->pModifyTime );
332 return pImpl->pChangeTime;
340 return TimeToString( pImpl->pChangeTime );
348 return pImpl->pAccessTime;
356 return TimeToString( pImpl->pAccessTime );
376 size_t size = pImpl->pMode.size();
378 uint8_t
oct = pImpl->pMode[size - 3] -
'0';
379 OctToString(
oct, ret );
381 oct = pImpl->pMode[size - 2] -
'0';
382 OctToString(
oct, ret );
384 oct = pImpl->pMode[size - 1] -
'0';
385 OctToString(
oct, ret );
395 return pImpl->pOwner;
403 return pImpl->pGroup;
411 return pImpl->pCksum;
419 return pImpl->pExtended;
427 return pImpl->pHasCksum;
439 pUtilizationStaging( 0 )
448 if( !data || strlen( data ) == 0 )
451 std::vector<std::string> chunks;
454 if( chunks.size() < 6 )
458 pNodesRW = ::strtoll( chunks[0].c_str(), &result, 0 );
465 pFreeRW = ::strtoll( chunks[1].c_str(), &result, 0 );
472 pUtilizationRW = ::strtol( chunks[2].c_str(), &result, 0 );
479 pNodesStaging = ::strtoll( chunks[3].c_str(), &result, 0 );
486 pFreeStaging = ::strtoll( chunks[4].c_str(), &result, 0 );
493 pUtilizationStaging = ::strtol( chunks[5].c_str(), &result, 0 );
496 pUtilizationStaging = 0;
503 const std::string DirectoryList::dStatPrefix =
".\n0 0 0 0";
517 for(
Iterator it = pDirList.begin(); it != pDirList.end(); ++it )
535 data += dStatPrefix.size();
549 std::string dat = data;
550 std::vector<std::string> entries;
551 std::vector<std::string>::iterator it;
559 for( it = entries.begin(); it != entries.end(); ++it )
567 if( entries.size() % 2 )
570 it = entries.begin();
571 for( ; it != entries.end(); ++it )
590 std::string dat = data;
591 return !dat.compare( 0, dStatPrefix.size(), dStatPrefix );
597 std::vector<uint32_t> &&
cksums = std::vector<uint32_t>() ) :
625 std::vector<uint32_t> &&cksums ) :
626 pImpl( new
PageInfoImpl( offset, length, buffer, std::move( cksums ) ) )
642 pImpl.swap( pginf.pImpl );
658 return pImpl->offset;
666 return pImpl->length;
674 return pImpl->buffer;
682 return pImpl->cksums;
690 pImpl->nbrepair = nbrepair;
698 return pImpl->nbrepair;
709 std::vector<std::tuple<uint64_t, uint32_t>>
retries;
731 return !pImpl->retries.empty();
739 return pImpl->retries.size();
748 return pImpl->retries[i];
765 std::unique_ptr<XRootDStatus> stptr( status );
766 std::unique_ptr<AnyObject> rspptr( response );
769 if( response ==
nullptr )
772 func( *status, *response );
783 return new FuncHandler( func );
799 func( status, response );
808 return new FuncHandler( func );
int access(const char *path, int amode)
void SetStatInfo(StatInfo *info)
Set the stat info object (and transfer the ownership)
DirectoryList()
Constructor.
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.
~DirectoryList()
Destructor.
bool ParseServerResponse(const std::string &hostId, const char *data)
Parse server response and fill up the object.
LocationInfo()
Constructor.
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)
StatInfoVFS()
Constructor.
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
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.
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.
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.
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)
std::tuple< uint64_t, uint32_t > At(size_t i)
RetryInfo(std::vector< std::tuple< uint64_t, uint32_t >> &&retries)
Constructor.
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.