Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //------------------------------------------------------------------------------
0002 // Copyright (c) 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_PLUGIN_INTERFACE__
0026 #define __XRD_CL_PLUGIN_INTERFACE__
0027 
0028 #include "XrdCl/XrdClFile.hh"
0029 #include "XrdCl/XrdClFileSystem.hh"
0030 #include "XrdCl/XrdClOptional.hh"
0031 
0032 namespace XrdCl
0033 {
0034 
0035   //----------------------------------------------------------------------------
0036   //! An interface for file plug-ins
0037   //----------------------------------------------------------------------------
0038   class FilePlugIn
0039   {
0040     public:
0041       //------------------------------------------------------------------------
0042       //! Destructor
0043       //------------------------------------------------------------------------
0044       virtual ~FilePlugIn() {}
0045       //------------------------------------------------------------------------
0046       //! @see XrdCl::File::Open
0047       //------------------------------------------------------------------------
0048       virtual XRootDStatus Open( const std::string &url,
0049                                  OpenFlags::Flags   flags,
0050                                  Access::Mode       mode,
0051                                  ResponseHandler   *handler,
0052                                  uint16_t           timeout )
0053       {
0054         (void)url; (void)flags; (void)mode; (void)handler; (void)timeout;
0055         return XRootDStatus( stError, errNotImplemented );
0056       }
0057 
0058       //------------------------------------------------------------------------
0059       //! @see XrdCl::File::Close
0060       //------------------------------------------------------------------------
0061       virtual XRootDStatus Close( ResponseHandler *handler,
0062                                   uint16_t         timeout )
0063       {
0064         (void)handler; (void)timeout;
0065         return XRootDStatus( stError, errNotImplemented );
0066       }
0067 
0068       //------------------------------------------------------------------------
0069       //! @see XrdCl::File::Stat
0070       //------------------------------------------------------------------------
0071       virtual XRootDStatus Stat( bool             force,
0072                                  ResponseHandler *handler,
0073                                  uint16_t         timeout )
0074       {
0075         (void)force; (void)handler; (void)timeout;
0076         return XRootDStatus( stError, errNotImplemented );
0077       }
0078 
0079       //------------------------------------------------------------------------
0080       //! @see XrdCl::File::Read
0081       //------------------------------------------------------------------------
0082       virtual XRootDStatus Read( uint64_t         offset,
0083                                  uint32_t         size,
0084                                  void            *buffer,
0085                                  ResponseHandler *handler,
0086                                  uint16_t         timeout )
0087       {
0088         (void)offset; (void)size; (void)buffer; (void)handler; (void)timeout;
0089         return XRootDStatus( stError, errNotImplemented );
0090       }
0091 
0092       //------------------------------------------------------------------------
0093       //! @see XrdCl::File::Read
0094       //------------------------------------------------------------------------
0095       virtual XRootDStatus Read( uint64_t            offset,
0096                                  uint32_t            size,
0097                                  Optional<uint64_t>  fdoff,
0098                                  int                 fd,
0099                                  ResponseHandler    *handler,
0100                                  uint16_t            timeout = 0 )
0101       {
0102         (void)offset; (void)size; (void)fdoff; (void)fd, (void)handler; (void)timeout;
0103         return XRootDStatus( stError, errNotImplemented );
0104       }
0105 
0106       //------------------------------------------------------------------------
0107       //! @see XrdCl:File PgRead
0108       //------------------------------------------------------------------------
0109       virtual XRootDStatus PgRead( uint64_t         offset,
0110                                    uint32_t         size,
0111                                    void            *buffer,
0112                                    ResponseHandler *handler,
0113                                    uint16_t         timeout )
0114       {
0115         (void)offset; (void)size; (void)buffer; (void)handler; (void)timeout;
0116         return XRootDStatus( stError, errNotImplemented );
0117       }
0118 
0119       //------------------------------------------------------------------------
0120       //! @see XrdCl::File::Write
0121       //------------------------------------------------------------------------
0122       virtual XRootDStatus Write( uint64_t         offset,
0123                                   uint32_t         size,
0124                                   const void      *buffer,
0125                                   ResponseHandler *handler,
0126                                   uint16_t         timeout )
0127       {
0128         (void)offset; (void)size; (void)buffer; (void)handler; (void)timeout;
0129         return XRootDStatus( stError, errNotImplemented );
0130       }
0131 
0132       //------------------------------------------------------------------------
0133       //! @see XrdCl::File::Write
0134       //------------------------------------------------------------------------
0135       virtual XRootDStatus Write( uint64_t          offset,
0136                                   Buffer          &&buffer,
0137                                   ResponseHandler  *handler,
0138                                   uint16_t          timeout = 0 )
0139       {
0140         (void)offset; (void)buffer; (void)handler; (void)timeout;
0141         return XRootDStatus( stError, errNotImplemented );
0142       }
0143 
0144       //------------------------------------------------------------------------
0145       //! @see XrdCl::File::Write
0146       //------------------------------------------------------------------------
0147       virtual XRootDStatus Write( uint64_t            offset,
0148                                   uint32_t            size,
0149                                   Optional<uint64_t>  fdoff,
0150                                   int                 fd,
0151                                   ResponseHandler    *handler,
0152                                   uint16_t            timeout = 0 )
0153       {
0154         (void)offset; (void)size; (void)fdoff; (void)fd, (void)handler; (void)timeout;
0155         return XRootDStatus( stError, errNotImplemented );
0156       }
0157 
0158       //------------------------------------------------------------------------
0159       //! @see XrdCl::File::PgWrite
0160       //------------------------------------------------------------------------
0161       virtual XRootDStatus PgWrite( uint64_t               offset,
0162                                     uint32_t               nbpgs,
0163                                     const void            *buffer,
0164                                     std::vector<uint32_t> &cksums,
0165                                     ResponseHandler       *handler,
0166                                     uint16_t               timeout )
0167       {
0168         (void)offset; (void)nbpgs; (void)buffer; (void)cksums, (void)handler; (void)timeout;
0169         return XRootDStatus( stError, errNotImplemented );
0170       }
0171 
0172       //------------------------------------------------------------------------
0173       //! @see XrdCl::File::Sync
0174       //------------------------------------------------------------------------
0175       virtual XRootDStatus Sync( ResponseHandler *handler,
0176                                  uint16_t         timeout )
0177       {
0178         (void)handler; (void)timeout;
0179         return XRootDStatus( stError, errNotImplemented );
0180       }
0181 
0182       //------------------------------------------------------------------------
0183       //! @see XrdCl::File::Truncate
0184       //------------------------------------------------------------------------
0185       virtual XRootDStatus Truncate( uint64_t         size,
0186                                      ResponseHandler *handler,
0187                                      uint16_t         timeout )
0188       {
0189         (void)size; (void)handler; (void)timeout;
0190         return XRootDStatus( stError, errNotImplemented );
0191       }
0192 
0193       //------------------------------------------------------------------------
0194       //! @see XrdCl::File::VectorRead
0195       //------------------------------------------------------------------------
0196       virtual XRootDStatus VectorRead( const ChunkList &chunks,
0197                                        void            *buffer,
0198                                        ResponseHandler *handler,
0199                                        uint16_t         timeout )
0200       {
0201         (void)chunks; (void)buffer; (void)handler; (void)timeout;
0202         return XRootDStatus( stError, errNotImplemented );
0203       }
0204 
0205       //------------------------------------------------------------------------
0206       //! @see XrdCl::File::VectorWrite
0207       //------------------------------------------------------------------------
0208       virtual XRootDStatus VectorWrite( const ChunkList &chunks,
0209                                         ResponseHandler *handler,
0210                                         uint16_t         timeout = 0 )
0211       {
0212         (void)chunks; (void)handler; (void)timeout;
0213         return XRootDStatus( stError, errNotImplemented );
0214       }
0215 
0216 
0217       //------------------------------------------------------------------------
0218       //! @see XrdCl::File::WriteV
0219       //------------------------------------------------------------------------
0220       virtual XRootDStatus WriteV( uint64_t            offset,
0221                                    const struct iovec *iov,
0222                                    int                 iovcnt,
0223                                    ResponseHandler    *handler,
0224                                    uint16_t            timeout = 0 )
0225       {
0226         (void)offset; (void)iov; (void)iovcnt; (void)handler; (void)timeout;
0227         return XRootDStatus( stError, errNotImplemented );
0228       }
0229 
0230       //------------------------------------------------------------------------
0231       //! @see XrdCl::File::Fcntl
0232       //------------------------------------------------------------------------
0233       virtual XRootDStatus Fcntl( const Buffer    &arg,
0234                                   ResponseHandler *handler,
0235                                   uint16_t         timeout )
0236       {
0237         (void)arg; (void)handler; (void)timeout;
0238         return XRootDStatus( stError, errNotImplemented );
0239       }
0240 
0241       //------------------------------------------------------------------------
0242       //! @see XrdCl::File::Visa
0243       //------------------------------------------------------------------------
0244       virtual XRootDStatus Visa( ResponseHandler *handler,
0245                                  uint16_t         timeout )
0246       {
0247         (void)handler; (void)timeout;
0248         return XRootDStatus( stError, errNotImplemented );
0249       }
0250 
0251       //------------------------------------------------------------------------
0252       //! @see XrdCl::File::IsOpen
0253       //------------------------------------------------------------------------
0254       virtual bool IsOpen() const
0255       {
0256         return false;
0257       }
0258 
0259       //------------------------------------------------------------------------
0260       //! @see XrdCl::File::SetProperty
0261       //------------------------------------------------------------------------
0262       virtual bool SetProperty( const std::string &name,
0263                                 const std::string &value )
0264       {
0265         (void)name; (void)value;
0266         return false;
0267       }
0268 
0269       //------------------------------------------------------------------------
0270       //! @see XrdCl::File::GetProperty
0271       //------------------------------------------------------------------------
0272       virtual bool GetProperty( const std::string &name,
0273                                 std::string &value ) const
0274       {
0275         (void)name; (void)value;
0276         return false;
0277       }
0278   };
0279 
0280   //----------------------------------------------------------------------------
0281   //! An interface for file plug-ins
0282   //----------------------------------------------------------------------------
0283   class FileSystemPlugIn
0284   {
0285     public:
0286       //------------------------------------------------------------------------
0287       //! Destructor
0288       //------------------------------------------------------------------------
0289       virtual ~FileSystemPlugIn() {}
0290 
0291       //------------------------------------------------------------------------
0292       //! @see XrdCl::FileSystem::Locate
0293       //------------------------------------------------------------------------
0294       virtual XRootDStatus Locate( const std::string &path,
0295                                    OpenFlags::Flags   flags,
0296                                    ResponseHandler   *handler,
0297                                    uint16_t           timeout )
0298       {
0299         (void)path; (void)flags; (void)handler; (void)timeout;
0300         return XRootDStatus( stError, errNotImplemented );
0301       }
0302 
0303       //------------------------------------------------------------------------
0304       //! @see XrdCl::FileSystem::DeepLocate
0305       //------------------------------------------------------------------------
0306       virtual XRootDStatus DeepLocate( const std::string &path,
0307                                        OpenFlags::Flags   flags,
0308                                        ResponseHandler   *handler,
0309                                        uint16_t           timeout )
0310       {
0311         (void)path; (void)flags; (void)handler; (void)timeout;
0312         return XRootDStatus( stError, errNotImplemented );
0313       }
0314 
0315       //------------------------------------------------------------------------
0316       //! @see XrdCl::FileSystem::Mv
0317       //------------------------------------------------------------------------
0318       virtual XRootDStatus Mv( const std::string &source,
0319                                const std::string &dest,
0320                                ResponseHandler   *handler,
0321                                uint16_t           timeout )
0322       {
0323         (void)source; (void)dest; (void)handler; (void)timeout;
0324         return XRootDStatus( stError, errNotImplemented );
0325       }
0326 
0327       //------------------------------------------------------------------------
0328       //! @see XrdCl::FileSystem::Query
0329       //------------------------------------------------------------------------
0330       virtual XRootDStatus Query( QueryCode::Code  queryCode,
0331                                   const Buffer    &arg,
0332                                   ResponseHandler *handler,
0333                                   uint16_t         timeout )
0334       {
0335         (void)queryCode; (void)arg; (void)handler; (void)timeout;
0336         return XRootDStatus( stError, errNotImplemented );
0337       }
0338 
0339       //------------------------------------------------------------------------
0340       //! @see XrdCl::FileSystem::Truncate
0341       //------------------------------------------------------------------------
0342       virtual XRootDStatus Truncate( const std::string &path,
0343                                      uint64_t           size,
0344                                      ResponseHandler   *handler,
0345                                      uint16_t           timeout )
0346       {
0347         (void)path; (void)size; (void)handler; (void)timeout;
0348         return XRootDStatus( stError, errNotImplemented );
0349       }
0350 
0351       //------------------------------------------------------------------------
0352       //! @see XrdCl::FileSystem::Rm
0353       //------------------------------------------------------------------------
0354       virtual XRootDStatus Rm( const std::string &path,
0355                                ResponseHandler   *handler,
0356                                uint16_t           timeout )
0357       {
0358         (void)path; (void)handler; (void)timeout;
0359         return XRootDStatus( stError, errNotImplemented );
0360       }
0361 
0362       //------------------------------------------------------------------------
0363       //! @see XrdCl::FileSystem::MkDir
0364       //------------------------------------------------------------------------
0365       virtual XRootDStatus MkDir( const std::string &path,
0366                                   MkDirFlags::Flags  flags,
0367                                   Access::Mode       mode,
0368                                   ResponseHandler   *handler,
0369                                   uint16_t           timeout )
0370       {
0371         (void)path; (void)flags; (void)mode; (void)handler; (void)timeout;
0372         return XRootDStatus( stError, errNotImplemented );
0373       }
0374 
0375       //------------------------------------------------------------------------
0376       //! @see XrdCl::FileSystem::RmDir
0377       //------------------------------------------------------------------------
0378       virtual XRootDStatus RmDir( const std::string &path,
0379                                   ResponseHandler   *handler,
0380                                   uint16_t           timeout )
0381       {
0382         (void)path; (void)handler; (void)timeout;
0383         return XRootDStatus( stError, errNotImplemented );
0384       }
0385 
0386       //------------------------------------------------------------------------
0387       //! @see XrdCl::FileSystem::ChMod
0388       //------------------------------------------------------------------------
0389       virtual XRootDStatus ChMod( const std::string &path,
0390                                   Access::Mode       mode,
0391                                   ResponseHandler   *handler,
0392                                   uint16_t           timeout )
0393       {
0394         (void)path; (void)mode; (void)handler; (void)timeout;
0395         return XRootDStatus( stError, errNotImplemented );
0396       }
0397 
0398       //------------------------------------------------------------------------
0399       //! @see XrdCl::FileSystem::Ping
0400       //------------------------------------------------------------------------
0401       virtual XRootDStatus Ping( ResponseHandler *handler,
0402                                  uint16_t         timeout )
0403       {
0404         (void)handler; (void)timeout;
0405         return XRootDStatus( stError, errNotImplemented );
0406       }
0407 
0408       //------------------------------------------------------------------------
0409       //! @see XrdCl::FileSystem::Stat
0410       //------------------------------------------------------------------------
0411       virtual XRootDStatus Stat( const std::string &path,
0412                                  ResponseHandler   *handler,
0413                                  uint16_t           timeout )
0414       {
0415         (void)path; (void)handler; (void)timeout;
0416         return XRootDStatus( stError, errNotImplemented );
0417       }
0418 
0419       //------------------------------------------------------------------------
0420       //! @see XrdCl::FileSystem::StatVFS
0421       //------------------------------------------------------------------------
0422       virtual XRootDStatus StatVFS( const std::string &path,
0423                                     ResponseHandler   *handler,
0424                                     uint16_t           timeout )
0425       {
0426         (void)path; (void)handler; (void)timeout;
0427         return XRootDStatus( stError, errNotImplemented );
0428       }
0429 
0430       //------------------------------------------------------------------------
0431       //! @see XrdCl::FileSystem::Protocol
0432       //------------------------------------------------------------------------
0433       virtual XRootDStatus Protocol( ResponseHandler *handler,
0434                                      uint16_t         timeout = 0 )
0435       {
0436         (void)handler; (void)timeout;
0437         return XRootDStatus( stError, errNotImplemented );
0438       }
0439 
0440       //------------------------------------------------------------------------
0441       //! @see XrdCl::FileSystem::DirlList
0442       //------------------------------------------------------------------------
0443       virtual XRootDStatus DirList( const std::string   &path,
0444                                     DirListFlags::Flags  flags,
0445                                     ResponseHandler     *handler,
0446                                     uint16_t             timeout )
0447       {
0448         (void)path; (void)flags; (void)handler; (void)timeout;
0449         return XRootDStatus( stError, errNotImplemented );
0450       }
0451 
0452       //------------------------------------------------------------------------
0453       //! @see XrdCl::FileSystem::SendInfo
0454       //------------------------------------------------------------------------
0455       virtual XRootDStatus SendInfo( const std::string &info,
0456                                      ResponseHandler   *handler,
0457                                      uint16_t           timeout )
0458       {
0459         (void)info; (void)handler; (void)timeout;
0460         return XRootDStatus( stError, errNotImplemented );
0461       }
0462 
0463       //------------------------------------------------------------------------
0464       //! @see XrdCl::FileSystem::Prepare
0465       //------------------------------------------------------------------------
0466       virtual XRootDStatus Prepare( const std::vector<std::string> &fileList,
0467                                     PrepareFlags::Flags             flags,
0468                                     uint8_t                         priority,
0469                                     ResponseHandler                *handler,
0470                                     uint16_t                        timeout )
0471       {
0472         (void)fileList; (void)flags; (void)priority; (void)handler;
0473         (void)timeout;
0474         return XRootDStatus( stError, errNotImplemented );
0475       }
0476 
0477       //------------------------------------------------------------------------
0478       //! @see XrdCl::FileSystem::SetXAttr
0479       //------------------------------------------------------------------------
0480       virtual XRootDStatus SetXAttr( const std::string           &path,
0481                                      const std::vector<xattr_t>  &attrs,
0482                                      ResponseHandler             *handler,
0483                                      uint16_t                     timeout )
0484       {
0485         (void)path; (void)attrs; (void)handler; (void)timeout;
0486         return XRootDStatus( stError, errNotImplemented );
0487       }
0488 
0489       //------------------------------------------------------------------------
0490       //! @see XrdCl::FileSystem::GetXAttr
0491       //------------------------------------------------------------------------
0492       virtual XRootDStatus GetXAttr( const std::string               &path,
0493                                      const std::vector<std::string>  &attrs,
0494                                      ResponseHandler                 *handler,
0495                                      uint16_t                         timeout )
0496       {
0497         (void)path; (void)attrs; (void)handler; (void)timeout;
0498         return XRootDStatus( stError, errNotImplemented );
0499       }
0500 
0501       //------------------------------------------------------------------------
0502       //! @see XrdCl::FileSystem::DelXAttr
0503       //------------------------------------------------------------------------
0504       virtual XRootDStatus DelXAttr( const std::string               &path,
0505                                      const std::vector<std::string>  &attrs,
0506                                      ResponseHandler                 *handler,
0507                                      uint16_t                         timeout )
0508       {
0509         (void)path; (void)attrs; (void)handler; (void)timeout;
0510         return XRootDStatus( stError, errNotImplemented );
0511       }
0512 
0513       //------------------------------------------------------------------------
0514       //! @see XrdCl::FileSystem::ListXAttr
0515       //------------------------------------------------------------------------
0516       virtual XRootDStatus ListXAttr( const std::string         &path,
0517                                       ResponseHandler           *handler,
0518                                       uint16_t                   timeout )
0519       {
0520         (void)path; (void)handler; (void)timeout;
0521         return XRootDStatus( stError, errNotImplemented );
0522       }
0523 
0524       //------------------------------------------------------------------------
0525       //! @see XrdCl::FileSystem::SetProperty
0526       //------------------------------------------------------------------------
0527       virtual bool SetProperty( const std::string &name,
0528                                 const std::string &value )
0529       {
0530         (void)name; (void)value;
0531         return false;
0532       }
0533 
0534       //------------------------------------------------------------------------
0535       //! @see XrdCl::FileSystem::GetProperty
0536       //------------------------------------------------------------------------
0537       virtual bool GetProperty( const std::string &name,
0538                                 std::string &value ) const
0539       {
0540         (void)name; (void)value;
0541         return false;
0542       }
0543   };
0544 
0545   //----------------------------------------------------------------------------
0546   //! Plugin factory
0547   //----------------------------------------------------------------------------
0548   class PlugInFactory
0549   {
0550     public:
0551       //------------------------------------------------------------------------
0552       //! Destructor
0553       //------------------------------------------------------------------------
0554       virtual ~PlugInFactory() {}
0555 
0556       //------------------------------------------------------------------------
0557       //! Create a file plug-in for the given URL
0558       //------------------------------------------------------------------------
0559       virtual FilePlugIn *CreateFile( const std::string &url ) = 0;
0560 
0561       //------------------------------------------------------------------------
0562       //! Create a file system plug-in for the given URL
0563       //------------------------------------------------------------------------
0564       virtual FileSystemPlugIn *CreateFileSystem( const std::string &url ) = 0;
0565   };
0566 }
0567 
0568 #endif // __XRD_CL_PLUGIN_INTERFACE__