Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:39

0001 //------------------------------------------------------------------------------
0002 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
0003 // Author: Lukasz Janyst <ljanyst@cern.ch>
0004 //------------------------------------------------------------------------------
0005 // This file is part of the XRootD software suite.
0006 //
0007 // XRootD is free software: you can redistribute it and/or modify
0008 // it under the terms of the GNU Lesser General Public License as published by
0009 // the Free Software Foundation, either version 3 of the License, or
0010 // (at your option) any later version.
0011 //
0012 // XRootD is distributed in the hope that it will be useful,
0013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0015 // GNU General Public License for more details.
0016 //
0017 // You should have received a copy of the GNU Lesser General Public License
0018 // along with XRootD.  If not, see <http://www.gnu.org/licenses/>.
0019 //
0020 // In applying this licence, CERN does not waive the privileges and immunities
0021 // granted to it by virtue of its status as an Intergovernmental Organization
0022 // or submit itself to any jurisdiction.
0023 //------------------------------------------------------------------------------
0024 
0025 #ifndef __XRD_CL_FILE_SYSTEM_HH__
0026 #define __XRD_CL_FILE_SYSTEM_HH__
0027 
0028 #include "XrdCl/XrdClURL.hh"
0029 #include "XrdCl/XrdClStatus.hh"
0030 #include "XrdOuc/XrdOucEnum.hh"
0031 #include "XrdOuc/XrdOucCompiler.hh"
0032 #include "XrdCl/XrdClXRootDResponses.hh"
0033 #include "XrdSys/XrdSysPthread.hh"
0034 #include "XProtocol/XProtocol.hh"
0035 #include <string>
0036 #include <vector>
0037 
0038 namespace XrdCl
0039 {
0040   class PostMaster;
0041   class FileSystemPlugIn;
0042   struct MessageSendParams;
0043 
0044   //----------------------------------------------------------------------------
0045   //! XRootD query request codes
0046   //----------------------------------------------------------------------------
0047   struct QueryCode
0048   {
0049     //--------------------------------------------------------------------------
0050     //! XRootD query request codes
0051     //--------------------------------------------------------------------------
0052     enum Code
0053     {
0054       Config         = kXR_Qconfig,    //!< Query server configuration
0055       ChecksumCancel = kXR_Qckscan,    //!< Query file checksum cancellation
0056       Checksum       = kXR_Qcksum,     //!< Query file checksum
0057       Opaque         = kXR_Qopaque,    //!< Implementation dependent
0058       OpaqueFile     = kXR_Qopaquf,    //!< Implementation dependent
0059       Prepare        = kXR_QPrep,      //!< Query prepare status
0060       Space          = kXR_Qspace,     //!< Query logical space stats
0061       Stats          = kXR_QStats,     //!< Query server stats
0062       Visa           = kXR_Qvisa,      //!< Query file visa attributes
0063       XAttr          = kXR_Qxattr      //!< Query file extended attributes
0064     };
0065   };
0066 
0067   //----------------------------------------------------------------------------
0068   //! Open flags, may be or'd when appropriate
0069   //----------------------------------------------------------------------------
0070   struct OpenFlags
0071   {
0072     //--------------------------------------------------------------------------
0073     //! Open flags, may be or'd when appropriate
0074     //--------------------------------------------------------------------------
0075     enum Flags
0076     {
0077       None     = 0,                 //!< Nothing
0078       Compress = kXR_compress,      //!< Read compressed data for open (ignored),
0079                                     //!< for kXR_locate return unique hosts
0080       Delete   = kXR_delete,        //!< Open a new file, deleting any existing
0081                                     //!< file
0082       Force    = kXR_force,         //!< Ignore file usage rules, for kXR_locate
0083                                     //!< it means ignoreing network dependencies
0084       MakePath = kXR_mkpath,        //!< Create directory path if it does not
0085                                     //!< already exist
0086       New      = kXR_new,           //!< Open the file only if it does not already
0087                                     //!< exist
0088       NoWait   = kXR_nowait,        //!< Open the file only if it does not cause
0089                                     //!< a wait. For locate: provide a location as
0090                                     //!< soon as one becomes known. This means
0091                                     //!< that not all locations are necessarily
0092                                     //!< returned. If the file does not exist a
0093                                     //!< wait is still imposed.
0094 //      Append   = kXR_open_apnd,   //!< Open only for appending
0095       Read     = kXR_open_read,     //!< Open only for reading
0096       Update   = kXR_open_updt,     //!< Open for reading and writing
0097       Write    = kXR_open_wrto,     //!< Open only for writing
0098       POSC     = kXR_posc,          //!< Enable Persist On Successful Close
0099                                     //!< processing
0100       Refresh  = kXR_refresh,       //!< Refresh the cached information on file's
0101                                     //!< location. Voids NoWait.
0102       Replica  = kXR_replica,       //!< The file is being opened for replica
0103                                     //!< creation
0104       SeqIO    = kXR_seqio,         //!< File will be read or written sequentially
0105       PrefName = kXR_prefname,      //!< Hostname response is prefered, applies
0106                                     //!< only to FileSystem::Locate
0107       IntentDirList = kXR_4dirlist  //!< Make sure the server knows we are doing
0108                                     //!< locate in context of a dir list operation
0109     };
0110   };
0111   XRDOUC_ENUM_OPERATORS( OpenFlags::Flags )
0112 
0113   //----------------------------------------------------------------------------
0114   //! Access mode
0115   //----------------------------------------------------------------------------
0116   struct Access
0117   {
0118     //--------------------------------------------------------------------------
0119     //! Access mode
0120     //--------------------------------------------------------------------------
0121     enum Mode
0122     {
0123       None = 0,
0124       UR   = kXR_ur,         //!< owner readable
0125       UW   = kXR_uw,         //!< owner writable
0126       UX   = kXR_ux,         //!< owner executable/browsable
0127       GR   = kXR_gr,         //!< group readable
0128       GW   = kXR_gw,         //!< group writable
0129       GX   = kXR_gx,         //!< group executable/browsable
0130       OR   = kXR_or,         //!< world readable
0131       OW   = kXR_ow,         //!< world writeable
0132       OX   = kXR_ox          //!< world executable/browsable
0133     };
0134   };
0135   XRDOUC_ENUM_OPERATORS( Access::Mode )
0136 
0137   //----------------------------------------------------------------------------
0138   //! MkDir flags
0139   //----------------------------------------------------------------------------
0140   struct MkDirFlags
0141   {
0142     enum Flags
0143     {
0144       None     = 0,  //!< Nothing special
0145       MakePath = 1   //!< create the entire directory tree if it doesn't exist
0146     };
0147   };
0148   XRDOUC_ENUM_OPERATORS( MkDirFlags::Flags )
0149 
0150   //----------------------------------------------------------------------------
0151   //! DirList flags
0152   //----------------------------------------------------------------------------
0153   struct DirListFlags
0154   {
0155     enum Flags
0156     {
0157       None      = 0,  //!< Nothing special
0158       Stat      = 1,  //!< Stat each entry
0159       Locate    = 2,  //!< Locate all servers hosting the directory and send
0160                       //!< the dirlist request to all of them
0161       Recursive = 4,  //!< Do a recursive listing
0162       Merge     = 8,  //!< Merge duplicates
0163       Chunked   = 16, //!< Serve chunked results for better performance
0164       Zip       = 32, //!< List content of ZIP files
0165       Cksm      = 64  //!< Get checksum for every entry
0166     };
0167   };
0168   XRDOUC_ENUM_OPERATORS( DirListFlags::Flags )
0169 
0170   //----------------------------------------------------------------------------
0171   //! Prepare flags
0172   //----------------------------------------------------------------------------
0173   struct PrepareFlags
0174   {
0175     enum Flags
0176     {
0177       None        = 0,              //!< no flags
0178       Colocate    = kXR_coloc,      //!< co-locate staged files, if possible
0179       Fresh       = kXR_fresh,      //!< refresh file access time even if
0180                                     //!< the location is known
0181       Stage       = kXR_stage,      //!< stage the file to disk if it is not
0182                                     //!< online
0183       WriteMode   = kXR_wmode,      //!< the file will be accessed for
0184                                     //!< modification
0185       Cancel      = kXR_cancel,     //!< cancel staging request
0186       Evict       = kXR_evict << 8  //!< evict the file from disk cache
0187                                     //!< we have to shift kXR_evict as its value
0188                                     //!< is the same as cancel's because this
0189                                     //!< flag goes to options extension
0190     };
0191   };
0192   XRDOUC_ENUM_OPERATORS( PrepareFlags::Flags )
0193 
0194   //----------------------------------------------------------------------------
0195   //! Forward declaration of the implementation class holding the data members
0196   //----------------------------------------------------------------------------
0197   struct FileSystemImpl;
0198 
0199   //----------------------------------------------------------------------------
0200   //! Send file/filesystem queries to an XRootD cluster
0201   //----------------------------------------------------------------------------
0202   class FileSystem
0203   {
0204     friend class AssignLBHandler;
0205     friend class ForkHandler;
0206 
0207     public:
0208       typedef std::vector<LocationInfo> LocationList; //!< Location list
0209 
0210       //------------------------------------------------------------------------
0211       //! Constructor
0212       //!
0213       //! @param url URL of the entry-point server to be contacted
0214       //! @param enablePlugIns enable the plug-in mechanism for this object
0215       //------------------------------------------------------------------------
0216       FileSystem( const URL &url, bool enablePlugIns = true );
0217 
0218       //------------------------------------------------------------------------
0219       //! Destructor
0220       //------------------------------------------------------------------------
0221       ~FileSystem();
0222 
0223       //------------------------------------------------------------------------
0224       //! Locate a file - async
0225       //!
0226       //! @param path    path to the file to be located
0227       //! @param flags   some of the OpenFlags::Flags
0228       //! @param handler handler to be notified when the response arrives,
0229       //!                the response parameter will hold a Buffer object
0230       //!                if the procedure is successful
0231       //! @param timeout timeout value, if 0 the environment default will
0232       //!                be used
0233       //! @return        status of the operation
0234       //------------------------------------------------------------------------
0235       XRootDStatus Locate( const std::string &path,
0236                            OpenFlags::Flags   flags,
0237                            ResponseHandler   *handler,
0238                            uint16_t           timeout = 0 )
0239                            XRD_WARN_UNUSED_RESULT;
0240 
0241       //------------------------------------------------------------------------
0242       //! Locate a file - sync
0243       //!
0244       //! @param path     path to the file to be located
0245       //! @param flags    some of the OpenFlags::Flags
0246       //! @param response the response (to be deleted by the user)
0247       //! @param timeout  timeout value, if 0 the environment default will
0248       //!                 be used
0249       //! @return         status of the operation
0250       //------------------------------------------------------------------------
0251       XRootDStatus Locate( const std::string  &path,
0252                            OpenFlags::Flags    flags,
0253                            LocationInfo      *&response,
0254                            uint16_t            timeout  = 0 )
0255                            XRD_WARN_UNUSED_RESULT;
0256 
0257       //------------------------------------------------------------------------
0258       //! Locate a file, recursively locate all disk servers - async
0259       //!
0260       //! @param path    path to the file to be located
0261       //! @param flags   some of the OpenFlags::Flags
0262       //! @param handler handler to be notified when the response arrives,
0263       //!                the response parameter will hold a Buffer object
0264       //!                if the procedure is successful
0265       //! @param timeout timeout value, if 0 the environment default will
0266       //!                be used
0267       //! @return        status of the operation
0268       //------------------------------------------------------------------------
0269       XRootDStatus DeepLocate( const std::string &path,
0270                                OpenFlags::Flags   flags,
0271                                ResponseHandler   *handler,
0272                                uint16_t           timeout = 0 )
0273                                XRD_WARN_UNUSED_RESULT;
0274 
0275       //------------------------------------------------------------------------
0276       //! Locate a file, recursively locate all disk servers - sync
0277       //!
0278       //! @param path     path to the file to be located
0279       //! @param flags    some of the OpenFlags::Flags
0280       //! @param response the response (to be deleted by the user)
0281       //! @param timeout  timeout value, if 0 the environment default will
0282       //!                 be used
0283       //! @return         status of the operation
0284       //------------------------------------------------------------------------
0285       XRootDStatus DeepLocate( const std::string  &path,
0286                                OpenFlags::Flags   flags,
0287                                LocationInfo      *&response,
0288                                uint16_t            timeout  = 0 )
0289                                XRD_WARN_UNUSED_RESULT;
0290 
0291       //------------------------------------------------------------------------
0292       //! Move a directory or a file - async
0293       //!
0294       //! @param source  the file or directory to be moved
0295       //! @param dest    the new name
0296       //! @param handler handler to be notified when the response arrives,
0297       //! @param timeout timeout value, if 0 the environment default will
0298       //!                be used
0299       //! @return        status of the operation
0300       //------------------------------------------------------------------------
0301       XRootDStatus Mv( const std::string &source,
0302                        const std::string &dest,
0303                        ResponseHandler   *handler,
0304                        uint16_t           timeout = 0 )
0305                        XRD_WARN_UNUSED_RESULT;
0306 
0307       //------------------------------------------------------------------------
0308       //! Move a directory or a file - sync
0309       //!
0310       //! @param source  the file or directory to be moved
0311       //! @param dest    the new name
0312       //! @param timeout timeout value, if 0 the environment default will
0313       //!                be used
0314       //! @return        status of the operation
0315       //------------------------------------------------------------------------
0316       XRootDStatus Mv( const std::string &source,
0317                        const std::string &dest,
0318                        uint16_t           timeout = 0 )
0319                        XRD_WARN_UNUSED_RESULT;
0320 
0321       //------------------------------------------------------------------------
0322       //! Obtain server information - async
0323       //!
0324       //! @param queryCode the query code as specified in the QueryCode struct
0325       //! @param arg       query argument
0326       //! @param handler   handler to be notified when the response arrives,
0327       //!                  the response parameter will hold a Buffer object
0328       //!                  if the procedure is successful
0329       //! @param timeout   timeout value, if 0 the environment default will
0330       //!                  be used
0331       //! @return          status of the operation
0332       //------------------------------------------------------------------------
0333       XRootDStatus Query( QueryCode::Code  queryCode,
0334                           const Buffer    &arg,
0335                           ResponseHandler *handler,
0336                           uint16_t         timeout = 0 )
0337                           XRD_WARN_UNUSED_RESULT;
0338 
0339       //------------------------------------------------------------------------
0340       //! Obtain server information - sync
0341       //!
0342       //! @param queryCode the query code as specified in the QueryCode struct
0343       //! @param arg       query argument
0344       //! @param response  the response (to be deleted by the user)
0345       //! @param timeout   timeout value, if 0 the environment default will
0346       //!                  be used
0347       //! @return          status of the operation
0348       //------------------------------------------------------------------------
0349       XRootDStatus Query( QueryCode::Code   queryCode,
0350                           const Buffer     &arg,
0351                           Buffer          *&response,
0352                           uint16_t          timeout = 0 )
0353                           XRD_WARN_UNUSED_RESULT;
0354 
0355       //------------------------------------------------------------------------
0356       //! Truncate a file - async
0357       //!
0358       //! @param path     path to the file to be truncated
0359       //! @param size     file size
0360       //! @param handler  handler to be notified when the response arrives
0361       //! @param timeout  timeout value, if 0 the environment default will
0362       //!                 be used
0363       //! @return         status of the operation
0364       //------------------------------------------------------------------------
0365       XRootDStatus Truncate( const std::string &path,
0366                              uint64_t           size,
0367                              ResponseHandler   *handler,
0368                              uint16_t           timeout = 0 )
0369                              XRD_WARN_UNUSED_RESULT;
0370 
0371       //------------------------------------------------------------------------
0372       //! Truncate a file - sync
0373       //!
0374       //! @param path     path to the file to be truncated
0375       //! @param size     file size
0376       //! @param timeout  timeout value, if 0 the environment default will
0377       //!                 be used
0378       //! @return         status of the operation
0379       //------------------------------------------------------------------------
0380       XRootDStatus Truncate( const std::string &path,
0381                              uint64_t           size,
0382                              uint16_t           timeout = 0 )
0383                              XRD_WARN_UNUSED_RESULT;
0384 
0385       //------------------------------------------------------------------------
0386       //! Remove a file - async
0387       //!
0388       //! @param path     path to the file to be removed
0389       //! @param handler  handler to be notified when the response arrives
0390       //! @param timeout  timeout value, if 0 the environment default will
0391       //!                 be used
0392       //! @return         status of the operation
0393       //------------------------------------------------------------------------
0394       XRootDStatus Rm( const std::string &path,
0395                        ResponseHandler   *handler,
0396                        uint16_t           timeout = 0 )
0397                        XRD_WARN_UNUSED_RESULT;
0398 
0399       //------------------------------------------------------------------------
0400       //! Remove a file - sync
0401       //!
0402       //! @param path     path to the file to be removed
0403       //! @param timeout  timeout value, if 0 the environment default will
0404       //!                 be used
0405       //! @return         status of the operation
0406       //------------------------------------------------------------------------
0407       XRootDStatus Rm( const std::string &path,
0408                        uint16_t           timeout = 0 )
0409                        XRD_WARN_UNUSED_RESULT;
0410 
0411       //------------------------------------------------------------------------
0412       //! Create a directory - async
0413       //!
0414       //! @param path     path to the directory
0415       //! @param flags    or'd MkDirFlags
0416       //! @param mode     access mode, or'd Access::Mode
0417       //! @param handler  handler to be notified when the response arrives
0418       //! @param timeout  timeout value, if 0 the environment default will
0419       //!                 be used
0420       //! @return         status of the operation
0421       //------------------------------------------------------------------------
0422       XRootDStatus MkDir( const std::string &path,
0423                           MkDirFlags::Flags  flags,
0424                           Access::Mode       mode,
0425                           ResponseHandler   *handler,
0426                           uint16_t           timeout = 0 )
0427                           XRD_WARN_UNUSED_RESULT;
0428 
0429       //------------------------------------------------------------------------
0430       //! Create a directory - sync
0431       //!
0432       //! @param path     path to the directory
0433       //! @param flags    or'd MkDirFlags
0434       //! @param mode     access mode, or'd Access::Mode
0435       //! @param timeout  timeout value, if 0 the environment default will
0436       //!                 be used
0437       //! @return         status of the operation
0438       //------------------------------------------------------------------------
0439       XRootDStatus MkDir( const std::string &path,
0440                           MkDirFlags::Flags  flags,
0441                           Access::Mode       mode,
0442                           uint16_t           timeout = 0 )
0443                           XRD_WARN_UNUSED_RESULT;
0444 
0445       //------------------------------------------------------------------------
0446       //! Remove a directory - async
0447       //!
0448       //! @param path     path to the directory to be removed
0449       //! @param handler  handler to be notified when the response arrives
0450       //! @param timeout  timeout value, if 0 the environment default will
0451       //!                 be used
0452       //! @return         status of the operation
0453       //------------------------------------------------------------------------
0454       XRootDStatus RmDir( const std::string &path,
0455                           ResponseHandler   *handler,
0456                           uint16_t           timeout = 0 )
0457                           XRD_WARN_UNUSED_RESULT;
0458 
0459       //------------------------------------------------------------------------
0460       //! Remove a directory - sync
0461       //!
0462       //! @param path     path to the directory to be removed
0463       //! @param timeout  timeout value, if 0 the environment default will
0464       //!                 be used
0465       //! @return         status of the operation
0466       //------------------------------------------------------------------------
0467       XRootDStatus RmDir( const std::string &path,
0468                           uint16_t           timeout = 0 )
0469                           XRD_WARN_UNUSED_RESULT;
0470 
0471       //------------------------------------------------------------------------
0472       //! Change access mode on a directory or a file - async
0473       //!
0474       //! @param path     file/directory path
0475       //! @param mode     access mode, or'd Access::Mode
0476       //! @param handler  handler to be notified when the response arrives
0477       //! @param timeout  timeout value, if 0 the environment default will
0478       //!                 be used
0479       //! @return         status of the operation
0480       //------------------------------------------------------------------------
0481       XRootDStatus ChMod( const std::string &path,
0482                           Access::Mode       mode,
0483                           ResponseHandler   *handler,
0484                           uint16_t           timeout = 0 )
0485                           XRD_WARN_UNUSED_RESULT;
0486 
0487       //------------------------------------------------------------------------
0488       //! Change access mode on a directory or a file - sync
0489       //!
0490       //! @param path     file/directory path
0491       //! @param mode     access mode, or'd Access::Mode
0492       //! @param timeout  timeout value, if 0 the environment default will
0493       //!                 be used
0494       //! @return         status of the operation
0495       //------------------------------------------------------------------------
0496       XRootDStatus ChMod( const std::string &path,
0497                           Access::Mode       mode,
0498                           uint16_t           timeout = 0 )
0499                           XRD_WARN_UNUSED_RESULT;
0500 
0501       //------------------------------------------------------------------------
0502       //! Check if the server is alive - async
0503       //!
0504       //! @param handler  handler to be notified when the response arrives
0505       //! @param timeout  timeout value, if 0 the environment default will
0506       //!                 be used
0507       //! @return         status of the operation
0508       //------------------------------------------------------------------------
0509       XRootDStatus Ping( ResponseHandler *handler,
0510                          uint16_t         timeout = 0 )
0511                          XRD_WARN_UNUSED_RESULT;
0512 
0513       //------------------------------------------------------------------------
0514       //! Check if the server is alive - sync
0515       //!
0516       //! @param timeout  timeout value, if 0 the environment default will
0517       //!                 be used
0518       //! @return         status of the operation
0519       //------------------------------------------------------------------------
0520       XRootDStatus Ping( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT;
0521 
0522       //------------------------------------------------------------------------
0523       //! Obtain status information for a path - async
0524       //!
0525       //! @param path    file/directory path
0526       //! @param handler handler to be notified when the response arrives,
0527       //!                the response parameter will hold a StatInfo object
0528       //!                if the procedure is successful
0529       //! @param timeout timeout value, if 0 the environment default will
0530       //!                be used
0531       //! @return        status of the operation
0532       //------------------------------------------------------------------------
0533       XRootDStatus Stat( const std::string &path,
0534                          ResponseHandler   *handler,
0535                          uint16_t           timeout = 0 )
0536                          XRD_WARN_UNUSED_RESULT;
0537 
0538       //------------------------------------------------------------------------
0539       //! Obtain status information for a path - sync
0540       //!
0541       //! @param path     file/directory path
0542       //! @param response the response (to be deleted by the user only if the
0543       //!                 procedure is successful)
0544       //! @param timeout  timeout value, if 0 the environment default will
0545       //!                 be used
0546       //! @return         status of the operation
0547       //------------------------------------------------------------------------
0548       XRootDStatus Stat( const std::string  &path,
0549                          StatInfo          *&response,
0550                          uint16_t            timeout = 0 )
0551                          XRD_WARN_UNUSED_RESULT;
0552 
0553       //------------------------------------------------------------------------
0554       //! Obtain status information for a Virtual File System - async
0555       //!
0556       //! @param path    file/directory path
0557       //! @param handler handler to be notified when the response arrives,
0558       //!                the response parameter will hold a StatInfoVFS object
0559       //!                if the procedure is successful
0560       //! @param timeout timeout value, if 0 the environment default will
0561       //!                be used
0562       //! @return        status of the operation
0563       //------------------------------------------------------------------------
0564       XRootDStatus StatVFS( const std::string &path,
0565                             ResponseHandler   *handler,
0566                             uint16_t           timeout = 0 )
0567                             XRD_WARN_UNUSED_RESULT;
0568 
0569       //------------------------------------------------------------------------
0570       //! Obtain status information for a Virtual File System - sync
0571       //!
0572       //! @param path     file/directory path
0573       //! @param response the response (to be deleted by the user)
0574       //! @param timeout  timeout value, if 0 the environment default will
0575       //!                 be used
0576       //! @return         status of the operation
0577       //------------------------------------------------------------------------
0578       XRootDStatus StatVFS( const std::string  &path,
0579                             StatInfoVFS       *&response,
0580                             uint16_t            timeout = 0 )
0581                             XRD_WARN_UNUSED_RESULT;
0582 
0583       //------------------------------------------------------------------------
0584       //! Obtain server protocol information - async
0585       //!
0586       //! @param handler handler to be notified when the response arrives,
0587       //!                the response parameter will hold a ProtocolInfo object
0588       //!                if the procedure is successful
0589       //! @param timeout timeout value, if 0 the environment default will
0590       //!                be used
0591       //! @return        status of the operation
0592       //------------------------------------------------------------------------
0593       XRootDStatus Protocol( ResponseHandler *handler,
0594                              uint16_t         timeout = 0 )
0595                              XRD_WARN_UNUSED_RESULT;
0596 
0597       //------------------------------------------------------------------------
0598       //! Obtain server protocol information - sync
0599       //!
0600       //! @param response the response (to be deleted by the user)
0601       //! @param timeout  timeout value, if 0 the environment default will
0602       //!                 be used
0603       //! @return         status of the operation
0604       //------------------------------------------------------------------------
0605       XRootDStatus Protocol( ProtocolInfo *&response,
0606                              uint16_t       timeout = 0 )
0607                              XRD_WARN_UNUSED_RESULT;
0608 
0609       //------------------------------------------------------------------------
0610       //! List entries of a directory - async
0611       //!
0612       //! @param path    directory path
0613       //! @param flags   currently unused
0614       //! @param handler handler to be notified when the response arrives,
0615       //!                the response parameter will hold a DirectoryList
0616       //!                object if the procedure is successful
0617       //! @param timeout timeout value, if 0 the environment default will
0618       //!                be used
0619       //! @return        status of the operation
0620       //------------------------------------------------------------------------
0621       XRootDStatus DirList( const std::string   &path,
0622                             DirListFlags::Flags  flags,
0623                             ResponseHandler     *handler,
0624                             uint16_t             timeout = 0 )
0625                             XRD_WARN_UNUSED_RESULT;
0626 
0627       //------------------------------------------------------------------------
0628       //! List entries of a directory - sync
0629       //!
0630       //! @param path     directory path
0631       //! @param flags    DirListFlags
0632       //! @param response the response (to be deleted by the user)
0633       //! @param timeout  timeout value, if 0 the environment default will
0634       //!                 be used
0635       //! @return         status of the operation
0636       //------------------------------------------------------------------------
0637       XRootDStatus DirList( const std::string    &path,
0638                             DirListFlags::Flags   flags,
0639                             DirectoryList       *&response,
0640                             uint16_t              timeout = 0 )
0641                             XRD_WARN_UNUSED_RESULT;
0642 
0643       //------------------------------------------------------------------------
0644       //! Send cache into the server - async
0645       //!
0646       //! @param info      the info string to be sent
0647       //! @param handler   handler to be notified when the response arrives,
0648       //!                  the response parameter will hold a Buffer object
0649       //!                  if the procedure is successful
0650       //! @param timeout   timeout value, if 0 the environment default will
0651       //!                  be used
0652       //! @return          status of the operation
0653       //------------------------------------------------------------------------
0654       XRootDStatus SendCache( const std::string &info,
0655                               ResponseHandler   *handler,
0656                               uint16_t           timeout = 0 )
0657                               XRD_WARN_UNUSED_RESULT;
0658 
0659       //------------------------------------------------------------------------
0660       //! Send cache into the server - sync
0661       //!
0662       //! @param info      the info string to be sent
0663       //! @param response  the response (to be deleted by the user)
0664       //! @param timeout   timeout value, if 0 the environment default will
0665       //!                  be used
0666       //! @return          status of the operation
0667       //------------------------------------------------------------------------
0668       XRootDStatus SendCache( const std::string  &info,
0669                               Buffer            *&response,
0670                               uint16_t            timeout = 0 )
0671                               XRD_WARN_UNUSED_RESULT;
0672 
0673       //------------------------------------------------------------------------
0674       //! Send info to the server (up to 1024 characters)- async
0675       //!
0676       //! @param info      the info string to be sent
0677       //! @param handler   handler to be notified when the response arrives,
0678       //!                  the response parameter will hold a Buffer object
0679       //!                  if the procedure is successful
0680       //! @param timeout   timeout value, if 0 the environment default will
0681       //!                  be used
0682       //! @return          status of the operation
0683       //------------------------------------------------------------------------
0684       XRootDStatus SendInfo( const std::string &info,
0685                              ResponseHandler   *handler,
0686                              uint16_t           timeout = 0 )
0687                              XRD_WARN_UNUSED_RESULT;
0688 
0689       //------------------------------------------------------------------------
0690       //! Send info to the server (up to 1024 characters) - sync
0691       //!
0692       //! @param info      the info string to be sent
0693       //! @param response  the response (to be deleted by the user)
0694       //! @param timeout   timeout value, if 0 the environment default will
0695       //!                  be used
0696       //! @return          status of the operation
0697       //------------------------------------------------------------------------
0698       XRootDStatus SendInfo( const std::string  &info,
0699                              Buffer            *&response,
0700                              uint16_t            timeout = 0 )
0701                              XRD_WARN_UNUSED_RESULT;
0702 
0703       //------------------------------------------------------------------------
0704       //! Prepare one or more files for access - async
0705       //!
0706       //! @param fileList  list of files to be prepared
0707       //! @param flags     PrepareFlags::Flags
0708       //! @param priority  priority of the request 0 (lowest) - 3 (highest)
0709       //! @param handler   handler to be notified when the response arrives,
0710       //!                  the response parameter will hold a Buffer object
0711       //!                  if the procedure is successful
0712       //! @param timeout   timeout value, if 0 the environment default will
0713       //!                  be used
0714       //! @return          status of the operation
0715       //------------------------------------------------------------------------
0716       XRootDStatus Prepare( const std::vector<std::string> &fileList,
0717                             PrepareFlags::Flags             flags,
0718                             uint8_t                         priority,
0719                             ResponseHandler                *handler,
0720                             uint16_t                        timeout = 0 )
0721                             XRD_WARN_UNUSED_RESULT;
0722 
0723       //------------------------------------------------------------------------
0724       //! Prepare one or more files for access - sync
0725       //!
0726       //! @param fileList  list of files to be prepared
0727       //! @param flags     PrepareFlags::Flags
0728       //! @param priority  priority of the request 0 (lowest) - 3 (highest)
0729       //! @param response  the response (to be deleted by the user)
0730       //! @param timeout   timeout value, if 0 the environment default will
0731       //!                  be used
0732       //! @return          status of the operation
0733       //------------------------------------------------------------------------
0734       XRootDStatus Prepare( const std::vector<std::string>  &fileList,
0735                             PrepareFlags::Flags              flags,
0736                             uint8_t                          priority,
0737                             Buffer                         *&response,
0738                             uint16_t                         timeout = 0 )
0739                             XRD_WARN_UNUSED_RESULT;
0740 
0741       //------------------------------------------------------------------------
0742       //! Set extended attributes - async
0743       //!
0744       //! @param attrs   : list of extended attributes to set
0745       //! @param handler : handler to be notified when the response arrives,
0746       //!                  the response parameter will hold a std::vector of
0747       //!                  XAttrStatus objects
0748       //! @param timeout : timeout value, if 0 the environment default will
0749       //!                  be used
0750       //!
0751       //! @return        : status of the operation
0752       //------------------------------------------------------------------------
0753       XRootDStatus SetXAttr( const std::string           &path,
0754                              const std::vector<xattr_t>  &attrs,
0755                              ResponseHandler             *handler,
0756                              uint16_t                     timeout = 0 );
0757 
0758       //------------------------------------------------------------------------
0759       //! Set extended attributes - sync
0760       //!
0761       //! @param attrs   : list of extended attributes to set
0762       //! @param result  : result of the operation
0763       //! @param timeout : timeout value, if 0 the environment default will
0764       //!                  be used
0765       //!
0766       //! @return        : status of the operation
0767       //------------------------------------------------------------------------
0768       XRootDStatus SetXAttr( const std::string           &path,
0769                              const std::vector<xattr_t>  &attrs,
0770                              std::vector<XAttrStatus>    &result,
0771                              uint16_t                     timeout = 0 );
0772 
0773       //------------------------------------------------------------------------
0774       //! Get extended attributes - async
0775       //!
0776       //! @param attrs   : list of extended attributes to get
0777       //! @param handler : handler to be notified when the response arrives,
0778       //!                  the response parameter will hold a std::vector of
0779       //!                  XAttr objects
0780       //! @param timeout : timeout value, if 0 the environment default will
0781       //!                  be used
0782       //!
0783       //! @return        : status of the operation
0784       //------------------------------------------------------------------------
0785       XRootDStatus GetXAttr( const std::string               &path,
0786                              const std::vector<std::string>  &attrs,
0787                              ResponseHandler                 *handler,
0788                              uint16_t                         timeout = 0 );
0789 
0790       //------------------------------------------------------------------------
0791       //! Get extended attributes - sync
0792       //!
0793       //! @param attrs   : list of extended attributes to get
0794       //! @param result  : result of the operation
0795       //! @param timeout : timeout value, if 0 the environment default will
0796       //!                  be used
0797       //!
0798       //! @return        : status of the operation
0799       //------------------------------------------------------------------------
0800       XRootDStatus GetXAttr( const std::string               &path,
0801                              const std::vector<std::string>  &attrs,
0802                              std::vector<XAttr>              &result,
0803                              uint16_t                         timeout = 0 );
0804 
0805       //------------------------------------------------------------------------
0806       //! Delete extended attributes - async
0807       //!
0808       //! @param attrs   : list of extended attributes to set
0809       //! @param handler : handler to be notified when the response arrives,
0810       //!                  the response parameter will hold a std::vector of
0811       //!                  XAttrStatus objects
0812       //! @param timeout : timeout value, if 0 the environment default will
0813       //!                  be used
0814       //!
0815       //! @return        : status of the operation
0816       //------------------------------------------------------------------------
0817       XRootDStatus DelXAttr( const std::string               &path,
0818                              const std::vector<std::string>  &attrs,
0819                              ResponseHandler                 *handler,
0820                              uint16_t                         timeout = 0 );
0821 
0822       //------------------------------------------------------------------------
0823       //! Delete extended attributes - sync
0824       //!
0825       //! @param attrs   : list of extended attributes to set
0826       //! @param result  : result of the operation
0827       //! @param timeout : timeout value, if 0 the environment default will
0828       //!                  be used
0829       //!
0830       //! @return        : status of the operation
0831       //------------------------------------------------------------------------
0832       XRootDStatus DelXAttr( const std::string               &path,
0833                              const std::vector<std::string>  &attrs,
0834                              std::vector<XAttrStatus>        &result,
0835                              uint16_t                         timeout = 0 );
0836 
0837       //------------------------------------------------------------------------
0838       //! List extended attributes - async
0839       //!
0840       //! @param handler : handler to be notified when the response arrives,
0841       //!                  the response parameter will hold a std::vector of
0842       //!                  XAttr objects
0843       //! @param timeout : timeout value, if 0 the environment default will
0844       //!                  be used
0845       //!
0846       //! @return        : status of the operation
0847       //------------------------------------------------------------------------
0848       XRootDStatus ListXAttr( const std::string         &path,
0849                               ResponseHandler           *handler,
0850                               uint16_t                   timeout = 0 );
0851 
0852       //------------------------------------------------------------------------
0853       //! List extended attributes - sync
0854       //!
0855       //! @param result  : result of the operation
0856       //! @param timeout : timeout value, if 0 the environment default will
0857       //!                  be used
0858       //!
0859       //! @return        : status of the operation
0860       //------------------------------------------------------------------------
0861       XRootDStatus ListXAttr( const std::string    &path,
0862                               std::vector<XAttr>   &result,
0863                               uint16_t              timeout = 0 );
0864 
0865       //------------------------------------------------------------------------
0866       //! Set filesystem property
0867       //!
0868       //! Filesystem properties:
0869       //! FollowRedirects  [true/false] - enable/disable following redirections
0870       //------------------------------------------------------------------------
0871       bool SetProperty( const std::string &name, const std::string &value );
0872 
0873       //------------------------------------------------------------------------
0874       //! Get filesystem property
0875       //!
0876       //! @see FileSystem::SetProperty for property list
0877       //------------------------------------------------------------------------
0878       bool GetProperty( const std::string &name, std::string &value ) const;
0879 
0880     private:
0881       FileSystem(const FileSystem &other);
0882       FileSystem &operator = (const FileSystem &other);
0883 
0884       //------------------------------------------------------------------------
0885       // Lock the internal lock
0886       //------------------------------------------------------------------------
0887       void Lock();
0888 
0889       //------------------------------------------------------------------------
0890       // Unlock the internal lock
0891       //------------------------------------------------------------------------
0892       void UnLock();
0893 
0894       //------------------------------------------------------------------------
0895       //! Generic implementation of SendCache and SendInfo
0896       //!
0897       //! @param info    : the info string to be sent
0898       //! @param handler : handler to be notified when the response arrives.
0899       //! @param timeout : timeout value or 0 for default.
0900       //! @return          status of the operation
0901       //------------------------------------------------------------------------
0902       XRootDStatus SendSet( const char        *prefix,
0903                             const std::string &info,
0904                             ResponseHandler   *handler,
0905                             uint16_t           timeout = 0 )
0906                             XRD_WARN_UNUSED_RESULT;
0907 
0908       //------------------------------------------------------------------------
0909       //! Generic implementation of xattr operation
0910       //!
0911       //! @param subcode : xattr operation code
0912       //! @param path    : path to the file
0913       //! @param attrs   : operation argument
0914       //! @param handler : operation handler
0915       //! @param timeout : operation timeout
0916       //------------------------------------------------------------------------
0917       template<typename T>
0918       Status XAttrOperationImpl( kXR_char              subcode,
0919                                  kXR_char              options,
0920                                  const std::string    &path,
0921                                  const std::vector<T> &attrs,
0922                                  ResponseHandler      *handler,
0923                                  uint16_t              timeout = 0 );
0924 
0925       FileSystemImpl   *pImpl;   //< pointer to implementation (TODO: once we can break ABI we can use a shared pointer here, and then we can drop the FileSystemData in source file)
0926       FileSystemPlugIn *pPlugIn; //< file system plug-in
0927   };
0928 }
0929 
0930 #endif // __XRD_CL_FILE_SYSTEM_HH__