19#ifndef __XRD_CL_XROOTD_RESPONSES_HH__
20#define __XRD_CL_XROOTD_RESPONSES_HH__
227 const std::string &message =
"" ):
235 const std::string &message =
"" ):
262 std::ostringstream o;
263 o <<
"[ERROR] Server responded with an error: [" <<
errNo <<
"] ";
289 typedef std::tuple<std::string, std::string>
xattr_t;
426 StatInfo(
const std::string &
id, uint64_t size, uint32_t flags,
544 time_t modTime = time;
545 tm *t = gmtime( &modTime );
546 strftime( ts, 255,
"%F %T", t );
552 static const uint8_t r_mask = 0x4;
553 static const uint8_t w_mask = 0x2;
554 static const uint8_t x_mask = 0x1;
556 if( r_mask & oct ) str.push_back(
'r' );
557 else str.push_back(
'-' );
559 if( w_mask & oct ) str.push_back(
'w' );
560 else str.push_back(
'-' );
562 if( x_mask & oct ) str.push_back(
'x' );
563 else str.push_back(
'-' );
566 std::unique_ptr<StatInfoImpl>
pImpl;
663 const std::string &name,
722 const char *cstr = name.c_str();
723 while( *cstr ==
'/' )
827 size_t pos = parent.find(
'?' );
828 pParent = pos == std::string::npos ? parent : parent.substr( 0, pos );
921 ChunkInfo( uint64_t off = 0, uint32_t len = 0,
void *buff = 0 ):
960 PageInfo( uint64_t offset = 0, uint32_t length = 0,
void *buffer = 0,
961 std::vector<uint32_t> &&cksums = std::vector<uint32_t>() );
1015 struct RetryInfoImpl;
1022 RetryInfo( std::vector<std::tuple<uint64_t, uint32_t>> && retries );
1043 std::tuple<uint64_t, uint32_t>
At(
size_t i );
1158 (void)status; (void)response;
#define kXR_isManager
Definition XProtocol.hh:1153
#define kXR_attrMeta
Definition XProtocol.hh:1155
#define kXR_attrSuper
Definition XProtocol.hh:1157
#define kXR_isServer
Definition XProtocol.hh:1154
#define kXR_attrProxy
Definition XProtocol.hh:1156
@ kXR_readable
Definition XProtocol.hh:1220
@ kXR_isDir
Definition XProtocol.hh:1217
@ kXR_offline
Definition XProtocol.hh:1219
@ kXR_bkpexist
Definition XProtocol.hh:1223
@ kXR_other
Definition XProtocol.hh:1218
@ kXR_poscpend
Definition XProtocol.hh:1222
@ kXR_writable
Definition XProtocol.hh:1221
@ kXR_xset
Definition XProtocol.hh:1216
#define access(a, b)
Definition XrdPosix.hh:39
Definition XrdClAnyObject.hh:33
Binary blob representation.
Definition XrdClBuffer.hh:34
Directory entry.
Definition XrdClXRootDResponses.hh:657
void SetStatInfo(StatInfo *info)
Set the stat info object (and transfer the ownership)
Definition XrdClXRootDResponses.hh:713
std::string pHostAddress
Definition XrdClXRootDResponses.hh:728
StatInfo * pStatInfo
Definition XrdClXRootDResponses.hh:730
const StatInfo * GetStatInfo() const
Get the stat info object.
Definition XrdClXRootDResponses.hh:705
const std::string & GetName() const
Get file name.
Definition XrdClXRootDResponses.hh:689
std::string pName
Definition XrdClXRootDResponses.hh:729
const std::string & GetHostAddress() const
Get host address.
Definition XrdClXRootDResponses.hh:681
ListEntry(const std::string &hostAddress, const std::string &name, StatInfo *statInfo=0)
Constructor.
Definition XrdClXRootDResponses.hh:662
~ListEntry()
Destructor.
Definition XrdClXRootDResponses.hh:673
static std::string SanitizeName(const std::string &name)
Definition XrdClXRootDResponses.hh:720
StatInfo * GetStatInfo()
Get the stat info object.
Definition XrdClXRootDResponses.hh:697
Directory list.
Definition XrdClXRootDResponses.hh:650
DirList pDirList
Definition XrdClXRootDResponses.hh:852
DirList::const_iterator ConstIterator
Directory listing const iterator.
Definition XrdClXRootDResponses.hh:756
DirectoryList()
Constructor.
bool ParseServerResponse(const std::string &hostId, const char *data, bool isDStat)
Parse chunked server response and fill up the object.
void Add(ListEntry *entry)
Add an entry to the list - takes ownership.
Definition XrdClXRootDResponses.hh:761
uint32_t GetSize() const
Get the size of the listing.
Definition XrdClXRootDResponses.hh:809
const std::string & GetParentName() const
Get parent directory name.
Definition XrdClXRootDResponses.hh:817
DirList::iterator Iterator
Directory listing iterator.
Definition XrdClXRootDResponses.hh:751
Iterator End()
Get the end iterator.
Definition XrdClXRootDResponses.hh:793
static bool HasStatInfo(const char *data)
Returns true if data contain stat info.
std::vector< ListEntry * > DirList
Directory listing.
Definition XrdClXRootDResponses.hh:746
~DirectoryList()
Destructor.
Iterator Begin()
Get the begin iterator.
Definition XrdClXRootDResponses.hh:777
ConstIterator End() const
Get the end iterator.
Definition XrdClXRootDResponses.hh:801
void SetParentName(const std::string &parent)
Set name of the parent directory.
Definition XrdClXRootDResponses.hh:825
bool ParseServerResponse(const std::string &hostId, const char *data)
Parse server response and fill up the object.
ConstIterator Begin() const
Get the begin iterator.
Definition XrdClXRootDResponses.hh:785
std::string pParent
Definition XrdClXRootDResponses.hh:853
static const std::string dStatPrefix
Definition XrdClXRootDResponses.hh:855
ListEntry * At(uint32_t index)
Get an entry at given index.
Definition XrdClXRootDResponses.hh:769
Handle the stateful operations.
Definition XrdClFileStateHandler.hh:80
Send file/filesystem queries to an XRootD cluster.
Definition XrdClFileSystem.hh:203
Location.
Definition XrdClXRootDResponses.hh:70
AccessType pAccess
Definition XrdClXRootDResponses.hh:126
std::string pAddress
Definition XrdClXRootDResponses.hh:124
LocationType GetType() const
Get location type.
Definition XrdClXRootDResponses.hh:94
bool IsServer() const
Check whether the location is a server.
Definition XrdClXRootDResponses.hh:110
Location(const std::string &address, LocationType type, AccessType access)
Constructor.
Definition XrdClXRootDResponses.hh:76
const std::string & GetAddress() const
Get address.
Definition XrdClXRootDResponses.hh:86
LocationType pType
Definition XrdClXRootDResponses.hh:125
AccessType GetAccessType() const
Get access type.
Definition XrdClXRootDResponses.hh:102
bool IsManager() const
Check whether the location is a manager.
Definition XrdClXRootDResponses.hh:118
Path location info.
Definition XrdClXRootDResponses.hh:44
uint32_t GetSize() const
Get number of locations.
Definition XrdClXRootDResponses.hh:152
LocationInfo()
Constructor.
Iterator Begin()
Get the location begin iterator.
Definition XrdClXRootDResponses.hh:168
Location & At(uint32_t index)
Get the location at index.
Definition XrdClXRootDResponses.hh:160
void Add(const Location &location)
Add a location.
Definition XrdClXRootDResponses.hh:200
std::vector< Location > LocationList
List of locations.
Definition XrdClXRootDResponses.hh:132
LocationList pLocations
Definition XrdClXRootDResponses.hh:212
LocationList::const_iterator ConstIterator
Iterator over locations.
Definition XrdClXRootDResponses.hh:142
ConstIterator Begin() const
Get the location begin iterator.
Definition XrdClXRootDResponses.hh:176
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.
Definition XrdClXRootDResponses.hh:61
@ Read
read access is allowed
Definition XrdClXRootDResponses.hh:62
@ ReadWrite
write access is allowed
Definition XrdClXRootDResponses.hh:63
LocationType
Describes the node type and file status for a given location.
Definition XrdClXRootDResponses.hh:50
@ ServerPending
server node where the file is pending to be online
Definition XrdClXRootDResponses.hh:54
@ ManagerOnline
manager node where the file is online
Definition XrdClXRootDResponses.hh:51
@ ServerOnline
server node where the file is online
Definition XrdClXRootDResponses.hh:53
@ ManagerPending
manager node where the file is pending to be online
Definition XrdClXRootDResponses.hh:52
ConstIterator End() const
Get the location end iterator.
Definition XrdClXRootDResponses.hh:192
bool ProcessLocation(std::string &location)
LocationList::iterator Iterator
Iterator over locations.
Definition XrdClXRootDResponses.hh:137
Iterator End()
Get the location end iterator.
Definition XrdClXRootDResponses.hh:184
Information returned by file open operation.
Definition XrdClXRootDResponses.hh:862
void GetFileHandle(uint8_t *fileHandle) const
Get the file handle (4bytes)
Definition XrdClXRootDResponses.hh:886
const StatInfo * GetStatInfo() const
Get the stat info.
Definition XrdClXRootDResponses.hh:894
OpenInfo(const uint8_t *fileHandle, uint64_t sessionId, StatInfo *statInfo=0)
Constructor.
Definition XrdClXRootDResponses.hh:867
uint64_t pSessionId
Definition XrdClXRootDResponses.hh:909
uint64_t GetSessionId() const
Definition XrdClXRootDResponses.hh:902
StatInfo * pStatInfo
Definition XrdClXRootDResponses.hh:910
uint8_t pFileHandle[4]
Definition XrdClXRootDResponses.hh:908
~OpenInfo()
Destructor.
Definition XrdClXRootDResponses.hh:878
Protocol response.
Definition XrdClXRootDResponses.hh:342
uint32_t pHostInfo
Definition XrdClXRootDResponses.hh:388
bool TestHostInfo(uint32_t flags)
Test host info flags.
Definition XrdClXRootDResponses.hh:381
HostTypes
Types of XRootD servers.
Definition XrdClXRootDResponses.hh:348
@ AttrProxy
Proxy attribute.
Definition XrdClXRootDResponses.hh:352
@ AttrMeta
Meta attribute.
Definition XrdClXRootDResponses.hh:351
@ IsManager
Manager.
Definition XrdClXRootDResponses.hh:349
@ AttrSuper
Supervisor attribute.
Definition XrdClXRootDResponses.hh:353
@ IsServer
Data server.
Definition XrdClXRootDResponses.hh:350
uint32_t GetVersion() const
Get version info.
Definition XrdClXRootDResponses.hh:365
ProtocolInfo(uint32_t version, uint32_t hostInfo)
Constructor.
Definition XrdClXRootDResponses.hh:359
uint32_t GetHostInfo() const
Get host info.
Definition XrdClXRootDResponses.hh:373
uint32_t pVersion
Definition XrdClXRootDResponses.hh:387
Handle an async response.
Definition XrdClXRootDResponses.hh:1126
static ResponseHandler * Wrap(std::function< void(XRootDStatus &, AnyObject &)> func)
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Definition XrdClXRootDResponses.hh:1139
static ResponseHandler * Wrap(std::function< void(XRootDStatus *, AnyObject *)> func)
virtual void HandleResponse(XRootDStatus *status, AnyObject *response)
Definition XrdClXRootDResponses.hh:1155
virtual ~ResponseHandler()
Definition XrdClXRootDResponses.hh:1128
VFS stat info.
Definition XrdClXRootDResponses.hh:573
uint64_t GetFreeRW() const
Get size of the largest contiguous area of free r/w space (in MB)
Definition XrdClXRootDResponses.hh:591
uint32_t pUtilizationRW
Definition XrdClXRootDResponses.hh:640
uint64_t GetNodesStaging() const
Get number of nodes that can provide staging space.
Definition XrdClXRootDResponses.hh:607
uint32_t pUtilizationStaging
Definition XrdClXRootDResponses.hh:643
uint8_t GetUtilizationStaging() const
Get percentage of the partition utilization represented by FreeStaging.
Definition XrdClXRootDResponses.hh:623
StatInfoVFS()
Constructor.
uint64_t GetFreeStaging() const
Get size of the largest contiguous area of free staging space (in MB)
Definition XrdClXRootDResponses.hh:615
uint64_t pFreeRW
Definition XrdClXRootDResponses.hh:639
uint64_t pFreeStaging
Definition XrdClXRootDResponses.hh:642
uint8_t GetUtilizationRW() const
Get percentage of the partition utilization represented by FreeRW.
Definition XrdClXRootDResponses.hh:599
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
uint64_t pNodesStaging
Definition XrdClXRootDResponses.hh:641
uint64_t GetNodesRW() const
Get number of nodes that can provide read/write space.
Definition XrdClXRootDResponses.hh:583
uint64_t pNodesRW
Definition XrdClXRootDResponses.hh:638
Object stat info.
Definition XrdClXRootDResponses.hh:400
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.
static void OctToString(uint8_t oct, std::string &str)
Definition XrdClXRootDResponses.hh:550
uint64_t GetSize() const
Get size (in bytes)
static std::string TimeToString(uint64_t time)
Definition XrdClXRootDResponses.hh:541
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.
Flags
Flags.
Definition XrdClXRootDResponses.hh:406
@ IsReadable
Read access is allowed.
Definition XrdClXRootDResponses.hh:413
@ IsDir
This is a directory.
Definition XrdClXRootDResponses.hh:408
@ Other
Neither a file nor a directory.
Definition XrdClXRootDResponses.hh:409
@ BackUpExists
Back up copy exists.
Definition XrdClXRootDResponses.hh:415
@ POSCPending
Definition XrdClXRootDResponses.hh:411
@ XBitSet
Executable/searchable bit set.
Definition XrdClXRootDResponses.hh:407
@ Offline
File is not online (ie. on disk)
Definition XrdClXRootDResponses.hh:410
@ IsWritable
Write access is allowed.
Definition XrdClXRootDResponses.hh:414
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)
StatInfo(const StatInfo &info)
Copy constructor.
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)
std::unique_ptr< StatInfoImpl > pImpl
Definition XrdClXRootDResponses.hh:566
void SetFlags(uint32_t flags)
Set flags.
StatInfo(const std::string &id, uint64_t size, uint32_t flags, uint64_t modTime)
Constructor.
const std::string & GetChecksum() const
Get checksum.
URL representation.
Definition XrdClURL.hh:31
Vector read info.
Definition XrdClXRootDResponses.hh:1061
uint32_t GetSize() const
Get Size.
Definition XrdClXRootDResponses.hh:1071
ChunkList pChunks
Definition XrdClXRootDResponses.hh:1101
const ChunkList & GetChunks() const
Get chunks.
Definition XrdClXRootDResponses.hh:1095
ChunkList & GetChunks()
Get chunks.
Definition XrdClXRootDResponses.hh:1087
VectorReadInfo()
Constructor.
Definition XrdClXRootDResponses.hh:1066
void SetSize(uint32_t size)
Set size.
Definition XrdClXRootDResponses.hh:1079
uint32_t pSize
Definition XrdClXRootDResponses.hh:1102
Request status.
Definition XrdClXRootDResponses.hh:219
const std::string & GetErrorMessage() const
Get error message.
Definition XrdClXRootDResponses.hh:242
void SetErrorMessage(const std::string &message)
Set the error message.
Definition XrdClXRootDResponses.hh:250
XRootDStatus(uint16_t st=0, uint16_t code=0, uint32_t errN=0, const std::string &message="")
Constructor.
Definition XrdClXRootDResponses.hh:224
std::string pMessage
Definition XrdClXRootDResponses.hh:274
XRootDStatus(const Status &st, const std::string &message="")
Constructor.
Definition XrdClXRootDResponses.hh:234
std::string ToStr() const
Convert to string.
Definition XrdClXRootDResponses.hh:258
Definition XrdClAction.hh:34
const uint16_t errErrorResponse
Definition XrdClStatus.hh:105
std::vector< HostInfo > HostList
Definition XrdClXRootDResponses.hh:1120
std::tuple< std::string, std::string > xattr_t
Extended attribute key - value pair.
Definition XrdClXRootDResponses.hh:289
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition XrdClXRootDResponses.hh:1055
Buffer BinaryDataInfo
Binary buffer.
Definition XrdClXRootDResponses.hh:336
@ xattr_name
Definition XrdClXRootDResponses.hh:282
@ xattr_value
Definition XrdClXRootDResponses.hh:283
Describe a data chunk for vector read.
Definition XrdClXRootDResponses.hh:917
void * buffer
length of the chunk
Definition XrdClXRootDResponses.hh:950
uint64_t GetOffset() const
Get the offset.
Definition XrdClXRootDResponses.hh:927
uint32_t GetLength() const
Get the data length.
Definition XrdClXRootDResponses.hh:935
uint32_t length
offset in the file
Definition XrdClXRootDResponses.hh:949
void * GetBuffer()
Get the buffer.
Definition XrdClXRootDResponses.hh:943
ChunkInfo(uint64_t off=0, uint32_t len=0, void *buff=0)
Constructor.
Definition XrdClXRootDResponses.hh:921
uint64_t offset
Definition XrdClXRootDResponses.hh:948
Definition XrdClXRootDResponses.hh:1109
HostInfo(const URL &u, bool lb=false)
Definition XrdClXRootDResponses.hh:1112
URL url
URL of the host.
Definition XrdClXRootDResponses.hh:1117
HostInfo()
Definition XrdClXRootDResponses.hh:1110
uint32_t protocol
Version of the protocol the host is speaking.
Definition XrdClXRootDResponses.hh:1115
bool loadBalancer
Was the host used as a load balancer.
Definition XrdClXRootDResponses.hh:1116
uint32_t flags
Host type.
Definition XrdClXRootDResponses.hh:1114
Definition XrdClXRootDResponses.hh:956
PageInfo(PageInfo &&pginf)
Move constructor.
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::unique_ptr< PageInfoImpl > pImpl
pointer to implementation
Definition XrdClXRootDResponses.hh:1012
Definition XrdClXRootDResponses.hh:1018
RetryInfo(std::vector< std::tuple< uint64_t, uint32_t > > &&retries)
Constructor.
std::tuple< uint64_t, uint32_t > At(size_t i)
std::unique_ptr< RetryInfoImpl > pImpl
pointer to implementation
Definition XrdClXRootDResponses.hh:1049
Procedure execution status.
Definition XrdClStatus.hh:115
uint16_t code
Error type, or additional hints on what to do.
Definition XrdClStatus.hh:147
std::string ToString() const
Create a string representation.
uint32_t errNo
Errno, if any.
Definition XrdClStatus.hh:148
Extended attribute operation status.
Definition XrdClXRootDResponses.hh:295
XAttrStatus(const std::string &name, const XRootDStatus &status)
Definition XrdClXRootDResponses.hh:299
XRootDStatus status
Definition XrdClXRootDResponses.hh:306
std::string name
Definition XrdClXRootDResponses.hh:305
Extended attributes with status.
Definition XrdClXRootDResponses.hh:313
XAttr(const std::string &name, const XRootDStatus &status)
Definition XrdClXRootDResponses.hh:317
std::string value
Definition XrdClXRootDResponses.hh:330
XAttr(const std::string &name, const std::string &value="", const XRootDStatus &status=XRootDStatus())
Definition XrdClXRootDResponses.hh:323