xrootd
XrdClXRootDResponses.hh
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 
19 #ifndef __XRD_CL_XROOTD_RESPONSES_HH__
20 #define __XRD_CL_XROOTD_RESPONSES_HH__
21 
22 #include "XrdCl/XrdClBuffer.hh"
23 #include "XrdCl/XrdClStatus.hh"
24 #include "XrdCl/XrdClURL.hh"
25 #include "XrdCl/XrdClAnyObject.hh"
26 #include "XProtocol/XProtocol.hh"
27 #include <string>
28 #include <vector>
29 #include <list>
30 #include <ctime>
31 #include <tuple>
32 #include <memory>
33 
34 namespace XrdCl
35 {
36  //----------------------------------------------------------------------------
38  //----------------------------------------------------------------------------
40  {
41  public:
42  //------------------------------------------------------------------------
44  //------------------------------------------------------------------------
46  {
51  };
52 
53  //------------------------------------------------------------------------
55  //------------------------------------------------------------------------
57  {
58  Read,
60  };
61 
62  //------------------------------------------------------------------------
64  //------------------------------------------------------------------------
65  class Location
66  {
67  public:
68 
69  //--------------------------------------------------------------------
71  //--------------------------------------------------------------------
72  Location( const std::string &address,
73  LocationType type,
75  pAddress( address ),
76  pType( type ),
77  pAccess( access ) {}
78 
79  //--------------------------------------------------------------------
81  //--------------------------------------------------------------------
82  const std::string &GetAddress() const
83  {
84  return pAddress;
85  }
86 
87  //--------------------------------------------------------------------
89  //--------------------------------------------------------------------
91  {
92  return pType;
93  }
94 
95  //--------------------------------------------------------------------
97  //--------------------------------------------------------------------
99  {
100  return pAccess;
101  }
102 
103  //--------------------------------------------------------------------
105  //--------------------------------------------------------------------
106  bool IsServer() const
107  {
108  return pType == ServerOnline || pType == ServerPending;
109  }
110 
111  //--------------------------------------------------------------------
113  //--------------------------------------------------------------------
114  bool IsManager() const
115  {
116  return pType == ManagerOnline || pType == ManagerPending;
117  }
118 
119  private:
120  std::string pAddress;
123  };
124 
125  //------------------------------------------------------------------------
127  //------------------------------------------------------------------------
128  typedef std::vector<Location> LocationList;
129 
130  //------------------------------------------------------------------------
132  //------------------------------------------------------------------------
133  typedef LocationList::iterator Iterator;
134 
135  //------------------------------------------------------------------------
137  //------------------------------------------------------------------------
138  typedef LocationList::const_iterator ConstIterator;
139 
140  //------------------------------------------------------------------------
142  //------------------------------------------------------------------------
143  LocationInfo();
144 
145  //------------------------------------------------------------------------
147  //------------------------------------------------------------------------
148  uint32_t GetSize() const
149  {
150  return pLocations.size();
151  }
152 
153  //------------------------------------------------------------------------
155  //------------------------------------------------------------------------
156  Location &At( uint32_t index )
157  {
158  return pLocations[index];
159  }
160 
161  //------------------------------------------------------------------------
163  //------------------------------------------------------------------------
165  {
166  return pLocations.begin();
167  }
168 
169  //------------------------------------------------------------------------
171  //------------------------------------------------------------------------
173  {
174  return pLocations.begin();
175  }
176 
177  //------------------------------------------------------------------------
179  //------------------------------------------------------------------------
181  {
182  return pLocations.end();
183  }
184 
185  //------------------------------------------------------------------------
187  //------------------------------------------------------------------------
189  {
190  return pLocations.end();
191  }
192 
193  //------------------------------------------------------------------------
195  //------------------------------------------------------------------------
196  void Add( const Location &location )
197  {
198  pLocations.push_back( location );
199  }
200 
201  //------------------------------------------------------------------------
203  //------------------------------------------------------------------------
204  bool ParseServerResponse( const char *data );
205 
206  private:
207  bool ProcessLocation( std::string &location );
209  };
210 
211  //----------------------------------------------------------------------------
213  //----------------------------------------------------------------------------
214  class XRootDStatus: public Status
215  {
216  public:
217  //------------------------------------------------------------------------
219  //------------------------------------------------------------------------
220  XRootDStatus( uint16_t st = 0,
221  uint16_t code = 0,
222  uint32_t errN = 0,
223  const std::string &message = "" ):
224  Status( st, code, errN ),
225  pMessage( message ) {}
226 
227  //------------------------------------------------------------------------
229  //------------------------------------------------------------------------
230  XRootDStatus( const Status &st,
231  const std::string &message = "" ):
232  Status( st ),
233  pMessage( message ) {}
234 
235  //------------------------------------------------------------------------
237  //------------------------------------------------------------------------
238  const std::string &GetErrorMessage() const
239  {
240  return pMessage;
241  }
242 
243  //------------------------------------------------------------------------
245  //------------------------------------------------------------------------
246  void SetErrorMessage( const std::string &message )
247  {
248  pMessage = message;
249  }
250 
251  //------------------------------------------------------------------------
253  //------------------------------------------------------------------------
254  std::string ToStr() const
255  {
256  if( code == errErrorResponse )
257  {
258  std::ostringstream o;
259  o << "[ERROR] Server responded with an error: [" << errNo << "] ";
260  o << pMessage << std::endl;
261  return o.str();
262  }
263  std::string str = ToString();
264  if( !pMessage.empty() )
265  str += ": " + pMessage;
266  return str;
267  }
268 
269  private:
270  std::string pMessage;
271  };
272 
273  //----------------------------------------------------------------------------
275  //----------------------------------------------------------------------------
276  enum
277  {
280  };
281 
282  //----------------------------------------------------------------------------
284  //----------------------------------------------------------------------------
285  typedef std::tuple<std::string, std::string> xattr_t;
286 
287  //----------------------------------------------------------------------------
289  //----------------------------------------------------------------------------
290  struct XAttrStatus
291  {
292  friend class FileStateHandler;
293  friend class FileSystem;
294 
295  XAttrStatus( const std::string &name, const XRootDStatus &status ) :
296  name( name ), status( status )
297  {
298 
299  }
300 
301  std::string name;
303  };
304 
305  //----------------------------------------------------------------------------
307  //----------------------------------------------------------------------------
308  struct XAttr : public XAttrStatus
309  {
310  friend class FileStateHandler;
311  friend class FileSystem;
312 
313  XAttr( const std::string &name, const XRootDStatus &status ) :
315  {
316 
317  }
318 
319  XAttr( const std::string &name, const std::string &value = "",
320  const XRootDStatus &status = XRootDStatus() ) :
322  {
323 
324  }
325 
326  std::string value;
327  };
328 
329  //----------------------------------------------------------------------------
331  //----------------------------------------------------------------------------
333 
334  //----------------------------------------------------------------------------
336  //----------------------------------------------------------------------------
338  {
339  public:
340  //------------------------------------------------------------------------
342  //------------------------------------------------------------------------
344  {
350  };
351 
352  //------------------------------------------------------------------------
354  //------------------------------------------------------------------------
355  ProtocolInfo( uint32_t version, uint32_t hostInfo ):
356  pVersion( version ), pHostInfo( hostInfo ) {}
357 
358  //------------------------------------------------------------------------
360  //------------------------------------------------------------------------
361  uint32_t GetVersion() const
362  {
363  return pVersion;
364  }
365 
366  //------------------------------------------------------------------------
368  //------------------------------------------------------------------------
369  uint32_t GetHostInfo() const
370  {
371  return pHostInfo;
372  }
373 
374  //------------------------------------------------------------------------
376  //------------------------------------------------------------------------
377  bool TestHostInfo( uint32_t flags )
378  {
379  return pHostInfo & flags;
380  }
381 
382  private:
383  uint32_t pVersion;
384  uint32_t pHostInfo;
385  };
386 
387  //----------------------------------------------------------------------------
389  //----------------------------------------------------------------------------
390  struct StatInfoImpl;
391 
392  //----------------------------------------------------------------------------
394  //----------------------------------------------------------------------------
395  class StatInfo
396  {
397  public:
398  //------------------------------------------------------------------------
400  //------------------------------------------------------------------------
401  enum Flags
402  {
412  };
413 
414  //------------------------------------------------------------------------
416  //------------------------------------------------------------------------
417  StatInfo();
418 
419  //------------------------------------------------------------------------
421  //------------------------------------------------------------------------
422  StatInfo( const std::string &id, uint64_t size, uint32_t flags,
423  uint64_t modTime );
424 
425  //------------------------------------------------------------------------
427  //------------------------------------------------------------------------
428  StatInfo( const StatInfo &info );
429 
430  //------------------------------------------------------------------------
432  //------------------------------------------------------------------------
433  ~StatInfo();
434 
435  //------------------------------------------------------------------------
437  //------------------------------------------------------------------------
438  const std::string& GetId() const;
439 
440  //------------------------------------------------------------------------
442  //------------------------------------------------------------------------
443  uint64_t GetSize() const;
444 
445  //------------------------------------------------------------------------
447  //------------------------------------------------------------------------
448  void SetSize( uint64_t size );
449 
450  //------------------------------------------------------------------------
452  //------------------------------------------------------------------------
453  uint32_t GetFlags() const;
454 
455  //------------------------------------------------------------------------
457  //------------------------------------------------------------------------
458  void SetFlags( uint32_t flags );
459 
460  //------------------------------------------------------------------------
462  //------------------------------------------------------------------------
463  bool TestFlags( uint32_t flags ) const;
464 
465  //------------------------------------------------------------------------
467  //------------------------------------------------------------------------
468  uint64_t GetModTime() const;
469 
470  //------------------------------------------------------------------------
472  //------------------------------------------------------------------------
473  std::string GetModTimeAsString() const;
474 
475  //------------------------------------------------------------------------
477  //------------------------------------------------------------------------
478  uint64_t GetChangeTime() const;
479 
480  //------------------------------------------------------------------------
482  //------------------------------------------------------------------------
483  std::string GetChangeTimeAsString() const;
484 
485  //------------------------------------------------------------------------
487  //------------------------------------------------------------------------
488  uint64_t GetAccessTime() const;
489 
490  //------------------------------------------------------------------------
492  //------------------------------------------------------------------------
493  std::string GetAccessTimeAsString() const;
494 
495  //------------------------------------------------------------------------
497  //------------------------------------------------------------------------
498  const std::string& GetModeAsString() const;
499 
500  //------------------------------------------------------------------------
502  //------------------------------------------------------------------------
503  const std::string GetModeAsOctString() const;
504 
505  //------------------------------------------------------------------------
507  //------------------------------------------------------------------------
508  const std::string& GetOwner() const;
509 
510  //------------------------------------------------------------------------
512  //------------------------------------------------------------------------
513  const std::string& GetGroup() const;
514 
515  //------------------------------------------------------------------------
517  //------------------------------------------------------------------------
518  const std::string& GetChecksum() const;
519 
520  //------------------------------------------------------------------------
522  //------------------------------------------------------------------------
523  bool ParseServerResponse( const char *data );
524 
525  //------------------------------------------------------------------------
527  //------------------------------------------------------------------------
528  bool ExtendedFormat() const;
529 
530  //------------------------------------------------------------------------
532  //------------------------------------------------------------------------
533  bool HasChecksum() const;
534 
535  private:
536 
537  static inline std::string TimeToString( uint64_t time )
538  {
539  char ts[256];
540  time_t modTime = time;
541  tm *t = gmtime( &modTime );
542  strftime( ts, 255, "%F %T", t );
543  return ts;
544  }
545 
546  static inline void OctToString( uint8_t oct, std::string &str )
547  {
548  static const uint8_t r_mask = 0x4;
549  static const uint8_t w_mask = 0x2;
550  static const uint8_t x_mask = 0x1;
551 
552  if( r_mask & oct ) str.push_back( 'r' );
553  else str.push_back( '-' );
554 
555  if( w_mask & oct ) str.push_back( 'w' );
556  else str.push_back( '-' );
557 
558  if( x_mask & oct ) str.push_back( 'x' );
559  else str.push_back( '-' );
560  }
561 
562  std::unique_ptr<StatInfoImpl> pImpl;
563  };
564 
565  //----------------------------------------------------------------------------
567  //----------------------------------------------------------------------------
569  {
570  public:
571  //------------------------------------------------------------------------
573  //------------------------------------------------------------------------
574  StatInfoVFS();
575 
576  //------------------------------------------------------------------------
578  //------------------------------------------------------------------------
579  uint64_t GetNodesRW() const
580  {
581  return pNodesRW;
582  }
583 
584  //------------------------------------------------------------------------
586  //------------------------------------------------------------------------
587  uint64_t GetFreeRW() const
588  {
589  return pFreeRW;
590  }
591 
592  //------------------------------------------------------------------------
594  //------------------------------------------------------------------------
595  uint8_t GetUtilizationRW() const
596  {
597  return pUtilizationRW;
598  }
599 
600  //------------------------------------------------------------------------
602  //------------------------------------------------------------------------
603  uint64_t GetNodesStaging() const
604  {
605  return pNodesStaging;
606  }
607 
608  //------------------------------------------------------------------------
610  //------------------------------------------------------------------------
611  uint64_t GetFreeStaging() const
612  {
613  return pFreeStaging;
614  }
615 
616  //------------------------------------------------------------------------
618  //------------------------------------------------------------------------
619  uint8_t GetUtilizationStaging() const
620  {
621  return pUtilizationStaging;
622  }
623 
624  //------------------------------------------------------------------------
626  //------------------------------------------------------------------------
627  bool ParseServerResponse( const char *data );
628 
629  private:
630 
631  //------------------------------------------------------------------------
632  // kXR_vfs stat
633  //------------------------------------------------------------------------
634  uint64_t pNodesRW;
635  uint64_t pFreeRW;
636  uint32_t pUtilizationRW;
637  uint64_t pNodesStaging;
638  uint64_t pFreeStaging;
640  };
641 
642  //----------------------------------------------------------------------------
644  //----------------------------------------------------------------------------
646  {
647  public:
648 
649  //------------------------------------------------------------------------
651  //------------------------------------------------------------------------
652  class ListEntry
653  {
654  public:
655  //--------------------------------------------------------------------
657  //--------------------------------------------------------------------
658  ListEntry( const std::string &hostAddress,
659  const std::string &name,
660  StatInfo *statInfo = 0):
661  pHostAddress( hostAddress ),
662  pName( name ),
663  pStatInfo( statInfo )
664  {}
665 
666  //--------------------------------------------------------------------
668  //--------------------------------------------------------------------
670  {
671  delete pStatInfo;
672  }
673 
674  //--------------------------------------------------------------------
676  //--------------------------------------------------------------------
677  const std::string &GetHostAddress() const
678  {
679  return pHostAddress;
680  }
681 
682  //--------------------------------------------------------------------
684  //--------------------------------------------------------------------
685  const std::string &GetName() const
686  {
687  return pName;
688  }
689 
690  //--------------------------------------------------------------------
692  //--------------------------------------------------------------------
694  {
695  return pStatInfo;
696  }
697 
698  //--------------------------------------------------------------------
700  //--------------------------------------------------------------------
701  const StatInfo *GetStatInfo() const
702  {
703  return pStatInfo;
704  }
705 
706  //--------------------------------------------------------------------
708  //--------------------------------------------------------------------
709  void SetStatInfo( StatInfo *info )
710  {
711  pStatInfo = info;
712  }
713 
714  private:
715  std::string pHostAddress;
716  std::string pName;
718  };
719 
720  //------------------------------------------------------------------------
722  //------------------------------------------------------------------------
723  DirectoryList();
724 
725  //------------------------------------------------------------------------
727  //------------------------------------------------------------------------
728  ~DirectoryList();
729 
730  //------------------------------------------------------------------------
732  //------------------------------------------------------------------------
733  typedef std::vector<ListEntry*> DirList;
734 
735  //------------------------------------------------------------------------
737  //------------------------------------------------------------------------
738  typedef DirList::iterator Iterator;
739 
740  //------------------------------------------------------------------------
742  //------------------------------------------------------------------------
743  typedef DirList::const_iterator ConstIterator;
744 
745  //------------------------------------------------------------------------
747  //------------------------------------------------------------------------
748  void Add( ListEntry *entry )
749  {
750  pDirList.push_back( entry );
751  }
752 
753  //------------------------------------------------------------------------
755  //------------------------------------------------------------------------
756  ListEntry *At( uint32_t index )
757  {
758  return pDirList[index];
759  }
760 
761  //------------------------------------------------------------------------
763  //------------------------------------------------------------------------
765  {
766  return pDirList.begin();
767  }
768 
769  //------------------------------------------------------------------------
771  //------------------------------------------------------------------------
773  {
774  return pDirList.begin();
775  }
776 
777  //------------------------------------------------------------------------
779  //------------------------------------------------------------------------
781  {
782  return pDirList.end();
783  }
784 
785  //------------------------------------------------------------------------
787  //------------------------------------------------------------------------
789  {
790  return pDirList.end();
791  }
792 
793  //------------------------------------------------------------------------
795  //------------------------------------------------------------------------
796  uint32_t GetSize() const
797  {
798  return pDirList.size();
799  }
800 
801  //------------------------------------------------------------------------
803  //------------------------------------------------------------------------
804  const std::string &GetParentName() const
805  {
806  return pParent;
807  }
808 
809  //------------------------------------------------------------------------
811  //------------------------------------------------------------------------
812  void SetParentName( const std::string &parent )
813  {
814  size_t pos = parent.find( '?' );
815  pParent = pos == std::string::npos ? parent : parent.substr( 0, pos );
816  if( !pParent.empty() && pParent[pParent.length()-1] != '/' )
817  pParent += "/";
818  }
819 
820  //------------------------------------------------------------------------
822  //------------------------------------------------------------------------
823  bool ParseServerResponse( const std::string &hostId,
824  const char *data );
825 
826  //------------------------------------------------------------------------
828  //------------------------------------------------------------------------
829  bool ParseServerResponse( const std::string &hostId,
830  const char *data,
831  bool isDStat );
832 
833  //------------------------------------------------------------------------
835  //------------------------------------------------------------------------
836  static bool HasStatInfo( const char *data );
837 
838  private:
840  std::string pParent;
841 
842  static const std::string dStatPrefix;
843  };
844 
845  //----------------------------------------------------------------------------
847  //----------------------------------------------------------------------------
848  class OpenInfo
849  {
850  public:
851  //------------------------------------------------------------------------
853  //------------------------------------------------------------------------
854  OpenInfo( const uint8_t *fileHandle,
855  uint64_t sessionId,
856  StatInfo *statInfo = 0 ):
857  pSessionId(sessionId), pStatInfo( statInfo )
858  {
859  memcpy( pFileHandle, fileHandle, 4 );
860  }
861 
862  //------------------------------------------------------------------------
864  //------------------------------------------------------------------------
866  {
867  delete pStatInfo;
868  }
869 
870  //------------------------------------------------------------------------
872  //------------------------------------------------------------------------
873  void GetFileHandle( uint8_t *fileHandle ) const
874  {
875  memcpy( fileHandle, pFileHandle, 4 );
876  }
877 
878  //------------------------------------------------------------------------
880  //------------------------------------------------------------------------
881  const StatInfo *GetStatInfo() const
882  {
883  return pStatInfo;
884  }
885 
886  //------------------------------------------------------------------------
887  // Get session ID
888  //------------------------------------------------------------------------
889  uint64_t GetSessionId() const
890  {
891  return pSessionId;
892  }
893 
894  private:
895  uint8_t pFileHandle[4];
896  uint64_t pSessionId;
898  };
899 
900  //----------------------------------------------------------------------------
902  //----------------------------------------------------------------------------
903  struct ChunkInfo
904  {
905  //--------------------------------------------------------------------------
907  //--------------------------------------------------------------------------
908  ChunkInfo( uint64_t off = 0, uint32_t len = 0, void *buff = 0 ):
909  offset( off ), length( len ), buffer(buff) {}
910 
911  uint64_t offset;
912  uint32_t length;
913  void *buffer;
914  };
915 
916  struct PageInfoImpl;
917 
918  struct PageInfo
919  {
920  //----------------------------------------------------------------------------
922  //----------------------------------------------------------------------------
923  PageInfo( uint64_t offset = 0, uint32_t length = 0, void *buffer = 0,
924  std::vector<uint32_t> &&cksums = std::vector<uint32_t>() );
925 
926  //----------------------------------------------------------------------------
928  //----------------------------------------------------------------------------
929  PageInfo( PageInfo &&pginf );
930 
931  //----------------------------------------------------------------------------
933  //----------------------------------------------------------------------------
934  ~PageInfo();
935 
936  //----------------------------------------------------------------------------
938  //----------------------------------------------------------------------------
939  uint64_t GetOffset() const;
940 
941  //----------------------------------------------------------------------------
943  //----------------------------------------------------------------------------
944  uint32_t GetLength() const;
945 
946  //----------------------------------------------------------------------------
948  //----------------------------------------------------------------------------
949  void* GetBuffer();
950 
951  //----------------------------------------------------------------------------
953  //----------------------------------------------------------------------------
954  std::vector<uint32_t>& GetCksums();
955 
956  private:
957  //--------------------------------------------------------------------------
959  //--------------------------------------------------------------------------
960  std::unique_ptr<PageInfoImpl> pImpl;
961  };
962 
963  //----------------------------------------------------------------------------
965  //----------------------------------------------------------------------------
966  typedef std::vector<ChunkInfo> ChunkList;
967 
968  //----------------------------------------------------------------------------
970  //----------------------------------------------------------------------------
972  {
973  public:
974  //------------------------------------------------------------------------
976  //------------------------------------------------------------------------
978 
979  //------------------------------------------------------------------------
981  //------------------------------------------------------------------------
982  uint32_t GetSize() const
983  {
984  return pSize;
985  }
986 
987  //------------------------------------------------------------------------
989  //------------------------------------------------------------------------
990  void SetSize( uint32_t size )
991  {
992  pSize = size;
993  }
994 
995  //------------------------------------------------------------------------
997  //------------------------------------------------------------------------
999  {
1000  return pChunks;
1001  }
1002 
1003  //------------------------------------------------------------------------
1005  //------------------------------------------------------------------------
1006  const ChunkList &GetChunks() const
1007  {
1008  return pChunks;
1009  }
1010 
1011  private:
1013  uint32_t pSize;
1014  };
1015 
1016  //----------------------------------------------------------------------------
1017  // List of URLs
1018  //----------------------------------------------------------------------------
1019  struct HostInfo
1020  {
1022  flags(0), protocol(0), loadBalancer(false) {}
1023  HostInfo( const URL &u, bool lb = false ):
1024  flags(0), protocol(0), loadBalancer(lb), url(u) {}
1025  uint32_t flags;
1026  uint32_t protocol;
1029  };
1030 
1031  typedef std::vector<HostInfo> HostList;
1032 
1033  //----------------------------------------------------------------------------
1035  //----------------------------------------------------------------------------
1037  {
1038  public:
1039  virtual ~ResponseHandler() {}
1040 
1041  //------------------------------------------------------------------------
1049  //------------------------------------------------------------------------
1050  virtual void HandleResponseWithHosts( XRootDStatus *status,
1051  AnyObject *response,
1052  HostList *hostList )
1053  {
1054  delete hostList;
1055  HandleResponse( status, response );
1056  }
1057 
1058  //------------------------------------------------------------------------
1065  //------------------------------------------------------------------------
1066  virtual void HandleResponse( XRootDStatus *status,
1067  AnyObject *response )
1068  {
1069  (void)status; (void)response;
1070  }
1071  };
1072 }
1073 
1074 #endif // __XRD_CL_XROOTD_RESPONSES_HH__
Write access is allowed.
Definition: XrdClXRootDResponses.hh:410
uint32_t pUtilizationStaging
Definition: XrdClXRootDResponses.hh:639
const std::string & GetAddress() const
Get address.
Definition: XrdClXRootDResponses.hh:82
ListEntry(const std::string &hostAddress, const std::string &name, StatInfo *statInfo=0)
Constructor.
Definition: XrdClXRootDResponses.hh:658
Definition: XProtocol.hh:1166
std::unique_ptr< PageInfoImpl > pImpl
pointer to implementation
Definition: XrdClXRootDResponses.hh:960
virtual ~ResponseHandler()
Definition: XrdClXRootDResponses.hh:1039
#define kXR_isServer
Definition: XProtocol.hh:1101
Definition: XrdClAnyObject.hh:32
const std::string & GetChecksum() const
Get checksum.
AccessType
Describes the allowed access type for the file at given location.
Definition: XrdClXRootDResponses.hh:56
const std::string & GetErrorMessage() const
Get error message.
Definition: XrdClXRootDResponses.hh:238
#define kXR_attrProxy
Definition: XProtocol.hh:1103
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:966
uint64_t pNodesStaging
Definition: XrdClXRootDResponses.hh:637
Extended attribute operation status.
Definition: XrdClXRootDResponses.hh:290
StatInfo * pStatInfo
Definition: XrdClXRootDResponses.hh:717
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
Definition: XProtocol.hh:1168
Directory list.
Definition: XrdClXRootDResponses.hh:645
AccessType GetAccessType() const
Get access type.
Definition: XrdClXRootDResponses.hh:98
uint64_t pFreeStaging
Definition: XrdClXRootDResponses.hh:638
const std::string & GetModeAsString() const
Get mode.
Meta attribute.
Definition: XrdClXRootDResponses.hh:347
uint64_t pFreeRW
Definition: XrdClXRootDResponses.hh:635
uint64_t GetFreeRW() const
Get size of the largest contiguous area of free r/w space (in MB)
Definition: XrdClXRootDResponses.hh:587
uint64_t GetNodesStaging() const
Get number of nodes that can provide staging space.
Definition: XrdClXRootDResponses.hh:603
Definition: XProtocol.hh:1169
std::string ToString() const
Create a string representation.
uint32_t GetHostInfo() const
Get host info.
Definition: XrdClXRootDResponses.hh:369
Object stat info.
Definition: XrdClXRootDResponses.hh:395
Definition: XrdClXRootDResponses.hh:407
ConstIterator End() const
Get the end iterator.
Definition: XrdClXRootDResponses.hh:788
const std::string & GetGroup() const
Get group.
const uint16_t errErrorResponse
Definition: XrdClStatus.hh:102
uint32_t pUtilizationRW
Definition: XrdClXRootDResponses.hh:636
Definition: XrdClXRootDResponses.hh:918
static bool HasStatInfo(const char *data)
Returns true if data contain stat info.
Extended attributes with status.
Definition: XrdClXRootDResponses.hh:308
#define kXR_attrMeta
Definition: XProtocol.hh:1102
bool IsManager() const
Check whether the location is a manager.
Definition: XrdClXRootDResponses.hh:114
ConstIterator Begin() const
Get the begin iterator.
Definition: XrdClXRootDResponses.hh:772
LocationInfo()
Constructor.
HostInfo()
Definition: XrdClXRootDResponses.hh:1021
Back up copy exists.
Definition: XrdClXRootDResponses.hh:411
static void OctToString(uint8_t oct, std::string &str)
Definition: XrdClXRootDResponses.hh:546
server node where the file is pending to be online
Definition: XrdClXRootDResponses.hh:50
Manager.
Definition: XrdClXRootDResponses.hh:345
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
uint64_t GetSize() const
Get size (in bytes)
Definition: XProtocol.hh:1165
const std::string & GetHostAddress() const
Get host address.
Definition: XrdClXRootDResponses.hh:677
void Add(ListEntry *entry)
Add an entry to the list - takes ownership.
Definition: XrdClXRootDResponses.hh:748
bool ExtendedFormat() const
Has extended stat information.
XRootDStatus(const Status &st, const std::string &message="")
Constructor.
Definition: XrdClXRootDResponses.hh:230
bool IsServer() const
Check whether the location is a server.
Definition: XrdClXRootDResponses.hh:106
std::string pMessage
Definition: XrdClXRootDResponses.hh:270
Path location info.
Definition: XrdClXRootDResponses.hh:39
uint16_t code
Error type, or additional hints on what to do.
Definition: XrdClStatus.hh:138
std::string GetChangeTimeAsString() const
Get change time.
XAttr(const std::string &name, const std::string &value="", const XRootDStatus &status=XRootDStatus())
Definition: XrdClXRootDResponses.hh:319
void SetErrorMessage(const std::string &message)
Set the error message.
Definition: XrdClXRootDResponses.hh:246
std::vector< Location > LocationList
List of locations.
Definition: XrdClXRootDResponses.hh:128
Location.
Definition: XrdClXRootDResponses.hh:65
uint8_t pFileHandle[4]
Definition: XrdClXRootDResponses.hh:895
uint64_t GetNodesRW() const
Get number of nodes that can provide read/write space.
Definition: XrdClXRootDResponses.hh:579
XAttrStatus(const std::string &name, const XRootDStatus &status)
Definition: XrdClXRootDResponses.hh:295
Iterator Begin()
Get the begin iterator.
Definition: XrdClXRootDResponses.hh:764
LocationType pType
Definition: XrdClXRootDResponses.hh:121
PageInfo(uint64_t offset=0, uint32_t length=0, void *buffer=0, std::vector< uint32_t > &&cksums=std::vector< uint32_t >())
Default constructor.
Procedure execution status.
Definition: XrdClStatus.hh:110
bool ParseServerResponse(const std::string &hostId, const char *data)
Parse server response and fill up the object.
ChunkList & GetChunks()
Get chunks.
Definition: XrdClXRootDResponses.hh:998
StatInfo * GetStatInfo()
Get the stat info object.
Definition: XrdClXRootDResponses.hh:693
uint64_t GetChangeTime() const
Get change time (in seconds since epoch)
Definition: XrdClXRootDResponses.hh:279
Definition: XProtocol.hh:1167
void SetParentName(const std::string &parent)
Set name of the parent directory.
Definition: XrdClXRootDResponses.hh:812
Information returned by file open operation.
Definition: XrdClXRootDResponses.hh:848
#define kXR_isManager
Definition: XProtocol.hh:1100
~OpenInfo()
Destructor.
Definition: XrdClXRootDResponses.hh:865
Definition: XProtocol.hh:1163
Iterator End()
Get the location end iterator.
Definition: XrdClXRootDResponses.hh:180
void * buffer
length of the chunk
Definition: XrdClXRootDResponses.hh:913
XRootDStatus(uint16_t st=0, uint16_t code=0, uint32_t errN=0, const std::string &message="")
Constructor.
Definition: XrdClXRootDResponses.hh:220
Protocol response.
Definition: XrdClXRootDResponses.hh:337
const ChunkList & GetChunks() const
Get chunks.
Definition: XrdClXRootDResponses.hh:1006
uint64_t GetFreeStaging() const
Get size of the largest contiguous area of free staging space (in MB)
Definition: XrdClXRootDResponses.hh:611
read access is allowed
Definition: XrdClXRootDResponses.hh:58
uint64_t pSessionId
Definition: XrdClXRootDResponses.hh:896
uint32_t GetFlags() const
Get flags.
bool ProcessLocation(std::string &location)
ListEntry * At(uint32_t index)
Get an entry at given index.
Definition: XrdClXRootDResponses.hh:756
const StatInfo * GetStatInfo() const
Get the stat info.
Definition: XrdClXRootDResponses.hh:881
uint8_t GetUtilizationRW() const
Get percentage of the partition utilization represented by FreeRW.
Definition: XrdClXRootDResponses.hh:595
Definition: XrdClXRootDResponses.hh:1019
Definition: XProtocol.hh:1162
uint32_t GetSize() const
Get number of locations.
Definition: XrdClXRootDResponses.hh:148
const std::string & GetId() const
Get id.
OpenInfo(const uint8_t *fileHandle, uint64_t sessionId, StatInfo *statInfo=0)
Constructor.
Definition: XrdClXRootDResponses.hh:854
std::string GetAccessTimeAsString() const
Get change time.
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1031
DirList::iterator Iterator
Directory listing iterator.
Definition: XrdClXRootDResponses.hh:738
uint64_t GetAccessTime() const
Get change time (in seconds since epoch)
const std::string & GetParentName() const
Get parent directory name.
Definition: XrdClXRootDResponses.hh:804
DirList pDirList
Definition: XrdClXRootDResponses.hh:839
LocationList pLocations
Definition: XrdClXRootDResponses.hh:208
uint32_t flags
Host type.
Definition: XrdClXRootDResponses.hh:1025
bool TestHostInfo(uint32_t flags)
Test host info flags.
Definition: XrdClXRootDResponses.hh:377
HostTypes
Types of XRootD servers.
Definition: XrdClXRootDResponses.hh:343
ChunkInfo(uint64_t off=0, uint32_t len=0, void *buff=0)
Constructor.
Definition: XrdClXRootDResponses.hh:908
const StatInfo * GetStatInfo() const
Get the stat info object.
Definition: XrdClXRootDResponses.hh:701
uint32_t length
offset in the file
Definition: XrdClXRootDResponses.hh:912
LocationList::iterator Iterator
Iterator over locations.
Definition: XrdClXRootDResponses.hh:133
manager node where the file is online
Definition: XrdClXRootDResponses.hh:47
Describe a data chunk for vector read.
Definition: XrdClXRootDResponses.hh:903
Request status.
Definition: XrdClXRootDResponses.hh:214
const std::string & GetName() const
Get file name.
Definition: XrdClXRootDResponses.hh:685
Definition: XrdClAnyObject.hh:25
std::string pHostAddress
Definition: XrdClXRootDResponses.hh:715
void SetStatInfo(StatInfo *info)
Set the stat info object (and transfer the ownership)
Definition: XrdClXRootDResponses.hh:709
LocationType GetType() const
Get location type.
Definition: XrdClXRootDResponses.hh:90
ProtocolInfo(uint32_t version, uint32_t hostInfo)
Constructor.
Definition: XrdClXRootDResponses.hh:355
XAttr(const std::string &name, const XRootDStatus &status)
Definition: XrdClXRootDResponses.hh:313
uint64_t GetOffset() const
Get the offset.
server node where the file is online
Definition: XrdClXRootDResponses.hh:49
uint32_t pSize
Definition: XrdClXRootDResponses.hh:1013
uint32_t protocol
Version of the protocol the host is speaking.
Definition: XrdClXRootDResponses.hh:1026
Supervisor attribute.
Definition: XrdClXRootDResponses.hh:349
VFS stat info.
Definition: XrdClXRootDResponses.hh:568
ChunkList pChunks
Definition: XrdClXRootDResponses.hh:1012
URL url
URL of the host.
Definition: XrdClXRootDResponses.hh:1028
~DirectoryList()
Destructor.
std::string pAddress
Definition: XrdClXRootDResponses.hh:120
Iterator End()
Get the end iterator.
Definition: XrdClXRootDResponses.hh:780
ConstIterator Begin() const
Get the location begin iterator.
Definition: XrdClXRootDResponses.hh:172
void SetSize(uint32_t size)
Set size.
Definition: XrdClXRootDResponses.hh:990
manager node where the file is pending to be online
Definition: XrdClXRootDResponses.hh:48
Location & At(uint32_t index)
Get the location at index.
Definition: XrdClXRootDResponses.hh:156
Flags
Flags.
Definition: XrdClXRootDResponses.hh:401
#define kXR_attrSuper
Definition: XProtocol.hh:1104
Vector read info.
Definition: XrdClXRootDResponses.hh:971
uint32_t GetVersion() const
Get version info.
Definition: XrdClXRootDResponses.hh:361
XRootDStatus status
Definition: XrdClXRootDResponses.hh:302
HostInfo(const URL &u, bool lb=false)
Definition: XrdClXRootDResponses.hh:1023
Handle an async response.
Definition: XrdClXRootDResponses.hh:1036
Location(const std::string &address, LocationType type, AccessType access)
Constructor.
Definition: XrdClXRootDResponses.hh:72
void * GetBuffer()
Get the buffer.
uint64_t offset
Definition: XrdClXRootDResponses.hh:911
StatInfo * pStatInfo
Definition: XrdClXRootDResponses.hh:897
AccessType pAccess
Definition: XrdClXRootDResponses.hh:122
std::string pParent
Definition: XrdClXRootDResponses.hh:840
uint32_t GetSize() const
Get the size of the listing.
Definition: XrdClXRootDResponses.hh:796
virtual void HandleResponse(XRootDStatus *status, AnyObject *response)
Definition: XrdClXRootDResponses.hh:1066
Handle the stateful operations.
Definition: XrdClFileStateHandler.hh:76
Neither a file nor a directory.
Definition: XrdClXRootDResponses.hh:405
uint64_t pNodesRW
Definition: XrdClXRootDResponses.hh:634
#define access(a, b)
Definition: XrdPosix.hh:39
URL representation.
Definition: XrdClURL.hh:30
void SetFlags(uint32_t flags)
Set flags.
std::unique_ptr< StatInfoImpl > pImpl
Definition: XrdClXRootDResponses.hh:562
virtual void HandleResponseWithHosts(XRootDStatus *status, AnyObject *response, HostList *hostList)
Definition: XrdClXRootDResponses.hh:1050
uint32_t errNo
Errno, if any.
Definition: XrdClStatus.hh:139
uint32_t GetSize() const
Get Size.
Definition: XrdClXRootDResponses.hh:982
This is a directory.
Definition: XrdClXRootDResponses.hh:404
Read access is allowed.
Definition: XrdClXRootDResponses.hh:409
Buffer BinaryDataInfo
Binary buffer.
Definition: XrdClXRootDResponses.hh:332
Proxy attribute.
Definition: XrdClXRootDResponses.hh:348
static const std::string dStatPrefix
Definition: XrdClXRootDResponses.hh:842
Data server.
Definition: XrdClXRootDResponses.hh:346
write access is allowed
Definition: XrdClXRootDResponses.hh:59
uint32_t pVersion
Definition: XrdClXRootDResponses.hh:383
uint32_t GetLength() const
Get the data length.
bool HasChecksum() const
Has checksum.
Send file/filesystem queries to an XRootD cluster.
Definition: XrdClFileSystem.hh:202
void GetFileHandle(uint8_t *fileHandle) const
Get the file handle (4bytes)
Definition: XrdClXRootDResponses.hh:873
uint32_t pHostInfo
Definition: XrdClXRootDResponses.hh:384
std::string value
Definition: XrdClXRootDResponses.hh:326
static std::string TimeToString(uint64_t time)
Definition: XrdClXRootDResponses.hh:537
Definition: XrdClXRootDResponses.hh:278
std::string pName
Definition: XrdClXRootDResponses.hh:716
StatInfo()
Constructor.
LocationType
Describes the node type and file status for a given location.
Definition: XrdClXRootDResponses.hh:45
~ListEntry()
Destructor.
Definition: XrdClXRootDResponses.hh:669
std::vector< uint32_t > & GetCksums()
Get the checksums.
bool ParseServerResponse(const char *data)
Parse server response and fill up the object.
StatInfoVFS()
Constructor.
DirList::const_iterator ConstIterator
Directory listing const iterator.
Definition: XrdClXRootDResponses.hh:743
DirectoryList()
Constructor.
~StatInfo()
Destructor.
void SetSize(uint64_t size)
Set size.
std::string GetModTimeAsString() const
Get modification time.
std::tuple< std::string, std::string > xattr_t
Extended attribute key - value pair.
Definition: XrdClXRootDResponses.hh:285
std::string ToStr() const
Convert to string.
Definition: XrdClXRootDResponses.hh:254
void Add(const Location &location)
Add a location.
Definition: XrdClXRootDResponses.hh:196
Executable/searchable bit set.
Definition: XrdClXRootDResponses.hh:403
~PageInfo()
Destructor.
VectorReadInfo()
Constructor.
Definition: XrdClXRootDResponses.hh:977
uint64_t GetModTime() const
Get modification time (in seconds since epoch)
const std::string GetModeAsOctString() const
Get mode.
bool loadBalancer
Was the host used as a load balancer.
Definition: XrdClXRootDResponses.hh:1027
uint64_t GetSessionId() const
Definition: XrdClXRootDResponses.hh:889
std::vector< ListEntry * > DirList
Directory listing.
Definition: XrdClXRootDResponses.hh:733
const std::string & GetOwner() const
Get owner.
File is not online (ie. on disk)
Definition: XrdClXRootDResponses.hh:406
uint8_t GetUtilizationStaging() const
Get percentage of the partition utilization represented by FreeStaging.
Definition: XrdClXRootDResponses.hh:619
ConstIterator End() const
Get the location end iterator.
Definition: XrdClXRootDResponses.hh:188
LocationList::const_iterator ConstIterator
Iterator over locations.
Definition: XrdClXRootDResponses.hh:138
Iterator Begin()
Get the location begin iterator.
Definition: XrdClXRootDResponses.hh:164
std::string name
Definition: XrdClXRootDResponses.hh:301
Binary blob representation.
Definition: XrdClBuffer.hh:33
Directory entry.
Definition: XrdClXRootDResponses.hh:652
Definition: XProtocol.hh:1164
bool TestFlags(uint32_t flags) const
Test flags.