Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 10:11:01

0001 /*
0002  * XrdClZipOperations.hh
0003  *
0004  *  Created on: 26 Nov 2020
0005  *      Author: simonm
0006  */
0007 
0008 #ifndef SRC_XRDCL_XRDCLZIPOPERATIONS_HH_
0009 #define SRC_XRDCL_XRDCLZIPOPERATIONS_HH_
0010 
0011 #include "XrdCl/XrdClZipArchive.hh"
0012 #include "XrdCl/XrdClOperations.hh"
0013 #include "XrdCl/XrdClOperationHandlers.hh"
0014 #include "XrdCl/XrdClCtx.hh"
0015 
0016 namespace XrdCl
0017 {
0018 
0019   //----------------------------------------------------------------------------
0020   //! Base class for all zip archive related operations
0021   //!
0022   //! @arg Derived : the class that derives from this template (CRTP)
0023   //! @arg HasHndl : true if operation has a handler, false otherwise
0024   //! @arg Args    : operation arguments
0025   //----------------------------------------------------------------------------
0026   template<template<bool> class Derived, bool HasHndl, typename Response, typename ... Arguments>
0027   class ZipOperation: public ConcreteOperation<Derived, HasHndl, Response, Arguments...>
0028   {
0029 
0030       template<template<bool> class, bool, typename, typename ...> friend class ZipOperation;
0031 
0032     public:
0033       //------------------------------------------------------------------------
0034       //! Constructor
0035       //!
0036       //! @param zip  : file on which the operation will be performed
0037       //! @param args : file operation arguments
0038       //------------------------------------------------------------------------
0039       ZipOperation( Ctx<ZipArchive> zip, Arguments... args): ConcreteOperation<Derived, false, Response, Arguments...>( std::move( args )... ), zip( std::move( zip ) )
0040       {
0041       }
0042 
0043       //------------------------------------------------------------------------
0044       //! Move constructor from other states
0045       //!
0046       //! @arg from : state from which the object is being converted
0047       //!
0048       //! @param op : the object that is being converted
0049       //------------------------------------------------------------------------
0050       template<bool from>
0051       ZipOperation( ZipOperation<Derived, from, Response, Arguments...> && op ) :
0052         ConcreteOperation<Derived, HasHndl, Response, Arguments...>( std::move( op ) ), zip( op.zip )
0053       {
0054 
0055       }
0056 
0057       //------------------------------------------------------------------------
0058       //! Destructor
0059       //------------------------------------------------------------------------
0060       virtual ~ZipOperation()
0061       {
0062 
0063       }
0064 
0065     protected:
0066 
0067       //------------------------------------------------------------------------
0068       //! The file object itself
0069       //------------------------------------------------------------------------
0070       Ctx<ZipArchive> zip;
0071   };
0072 
0073   //----------------------------------------------------------------------------
0074   //! OpenArchive operation (@see ZipOperation)
0075   //----------------------------------------------------------------------------
0076   template<bool HasHndl>
0077   class OpenArchiveImpl: public ZipOperation<OpenArchiveImpl, HasHndl, Resp<void>,
0078       Arg<std::string>, Arg<OpenFlags::Flags>>
0079   {
0080     public:
0081 
0082       //------------------------------------------------------------------------
0083       //! Inherit constructors from FileOperation (@see FileOperation)
0084       //------------------------------------------------------------------------
0085       using ZipOperation<OpenArchiveImpl, HasHndl, Resp<void>, Arg<std::string>,
0086                           Arg<OpenFlags::Flags>>::ZipOperation;
0087 
0088       //------------------------------------------------------------------------
0089       //! Argument indexes in the args tuple
0090       //------------------------------------------------------------------------
0091       enum { UrlArg, FlagsArg };
0092 
0093       //------------------------------------------------------------------------
0094       //! @return : name of the operation (@see Operation)
0095       //------------------------------------------------------------------------
0096       std::string ToString()
0097       {
0098         return "ZipOpen";
0099       }
0100 
0101     protected:
0102 
0103       //------------------------------------------------------------------------
0104       //! RunImpl operation (@see Operation)
0105       //!
0106       //! @param params :  container with parameters forwarded from
0107       //!                  previous operation
0108       //! @return       :  status of the operation
0109       //------------------------------------------------------------------------
0110       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0111       {
0112         std::string      &url     = std::get<UrlArg>( this->args ).Get();
0113         OpenFlags::Flags  flags   = std::get<FlagsArg>( this->args ).Get();
0114         uint16_t          timeout = pipelineTimeout < this->timeout ?
0115                                    pipelineTimeout : this->timeout;
0116         return this->zip->OpenArchive( url, flags, handler, timeout );
0117       }
0118   };
0119 
0120   //----------------------------------------------------------------------------
0121   //! Factory for creating OpenArchiveImpl objects
0122   //----------------------------------------------------------------------------
0123   inline OpenArchiveImpl<false> OpenArchive( Ctx<ZipArchive> zip, Arg<std::string> fn,
0124       Arg<OpenFlags::Flags> flags, uint16_t timeout = 0 )
0125   {
0126     return OpenArchiveImpl<false>( std::move( zip ), std::move( fn ),
0127                                    std::move( flags ) ).Timeout( timeout );
0128   }
0129 
0130 
0131   //----------------------------------------------------------------------------
0132   //! OpenFile operation (@see ZipOperation)
0133   //----------------------------------------------------------------------------
0134   template<bool HasHndl>
0135   class OpenFileImpl: public ZipOperation<OpenFileImpl, HasHndl, Resp<void>,
0136       Arg<std::string>, Arg<OpenFlags::Flags>, Arg<uint64_t>, Arg<uint32_t>>
0137   {
0138     public:
0139 
0140       //------------------------------------------------------------------------
0141       //! Inherit constructors from FileOperation (@see FileOperation)
0142       //------------------------------------------------------------------------
0143       using ZipOperation<OpenFileImpl, HasHndl, Resp<void>, Arg<std::string>,
0144           Arg<OpenFlags::Flags>, Arg<uint64_t>, Arg<uint32_t>>::ZipOperation;
0145 
0146       //------------------------------------------------------------------------
0147       //! Argument indexes in the args tuple
0148       //------------------------------------------------------------------------
0149       enum { FnArg, FlagsArg, SizeArg, Crc32Arg };
0150 
0151       //------------------------------------------------------------------------
0152       //! @return : name of the operation (@see Operation)
0153       //------------------------------------------------------------------------
0154       std::string ToString()
0155       {
0156         return "ZipOpenFile";
0157       }
0158 
0159     protected:
0160 
0161       //------------------------------------------------------------------------
0162       //! RunImpl operation (@see Operation)
0163       //!
0164       //! @param params :  container with parameters forwarded from
0165       //!                  previous operation
0166       //! @return       :  status of the operation
0167       //------------------------------------------------------------------------
0168       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0169       {
0170         std::string      &fn      = std::get<FnArg>( this->args ).Get();
0171         OpenFlags::Flags  flags   = std::get<FlagsArg>( this->args ).Get();
0172         uint64_t          size    = std::get<SizeArg>( this->args ).Get();
0173         uint32_t          crc32   = std::get<Crc32Arg>( this->args ).Get();
0174         XRootDStatus st = this->zip->OpenFile( fn, flags, size, crc32 );
0175         if( !st.IsOK() ) return st;
0176         handler->HandleResponse( new XRootDStatus(), nullptr );
0177         return XRootDStatus();
0178       }
0179   };
0180 
0181   //----------------------------------------------------------------------------
0182   //! Factory for creating OpenFileImpl objects
0183   //----------------------------------------------------------------------------
0184   inline OpenFileImpl<false> OpenFile( Ctx<ZipArchive> zip, Arg<std::string> fn,
0185       Arg<OpenFlags::Flags> flags = OpenFlags::None, Arg<uint64_t> size = 0,
0186       Arg<uint32_t> crc32 = 0, uint16_t timeout = 0 )
0187   {
0188     return OpenFileImpl<false>( std::move( zip ), std::move( fn ), std::move( flags ),
0189         std::move( size ), std::move( crc32 ) ).Timeout( timeout );
0190   }
0191 
0192 
0193   //----------------------------------------------------------------------------
0194   //! Read operation (@see ZipOperation)
0195   //----------------------------------------------------------------------------
0196   template<bool HasHndl>
0197   class ZipReadImpl: public ZipOperation<ZipReadImpl, HasHndl, Resp<ChunkInfo>,
0198       Arg<uint64_t>, Arg<uint32_t>, Arg<void*>>
0199   {
0200     public:
0201 
0202       //------------------------------------------------------------------------
0203       //! Inherit constructors from FileOperation (@see FileOperation)
0204       //------------------------------------------------------------------------
0205       using ZipOperation<ZipReadImpl, HasHndl, Resp<ChunkInfo>, Arg<uint64_t>,
0206           Arg<uint32_t>, Arg<void*>>::ZipOperation;
0207 
0208       //------------------------------------------------------------------------
0209       //! Argument indexes in the args tuple
0210       //------------------------------------------------------------------------
0211       enum { OffsetArg, SizeArg, BufferArg };
0212 
0213       //------------------------------------------------------------------------
0214       //! @return : name of the operation (@see Operation)
0215       //------------------------------------------------------------------------
0216       std::string ToString()
0217       {
0218         return "ZipRead";
0219       }
0220 
0221     protected:
0222 
0223       //------------------------------------------------------------------------
0224       //! RunImpl operation (@see Operation)
0225       //!
0226       //! @param params :  container with parameters forwarded from
0227       //!                  previous operation
0228       //! @return       :  status of the operation
0229       //------------------------------------------------------------------------
0230       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0231       {
0232         uint64_t  offset  = std::get<OffsetArg>( this->args ).Get();
0233         uint32_t  size    = std::get<SizeArg>( this->args ).Get();
0234         void     *buffer  = std::get<BufferArg>( this->args ).Get();
0235         uint16_t  timeout = pipelineTimeout < this->timeout ?
0236                             pipelineTimeout : this->timeout;
0237         return this->zip->Read( offset, size, buffer, handler, timeout );
0238       }
0239   };
0240 
0241   //----------------------------------------------------------------------------
0242   //! Factory for creating ArchiveReadImpl objects
0243   //----------------------------------------------------------------------------
0244   inline ZipReadImpl<false> Read( Ctx<ZipArchive> zip, Arg<uint64_t> offset, Arg<uint32_t> size,
0245                                   Arg<void*> buffer, uint16_t timeout = 0 )
0246   {
0247     return ZipReadImpl<false>( std::move( zip ), std::move( offset ), std::move( size ),
0248                                std::move( buffer ) ).Timeout( timeout );
0249   }
0250   //----------------------------------------------------------------------------
0251   //! Read operation (@see ZipOperation)
0252   //----------------------------------------------------------------------------
0253   template<bool HasHndl>
0254   class ZipReadFromImpl: public ZipOperation<ZipReadFromImpl, HasHndl, Resp<ChunkInfo>,
0255       Arg<std::string>, Arg<uint64_t>, Arg<uint32_t>, Arg<void*>>
0256   {
0257     public:
0258 
0259       //------------------------------------------------------------------------
0260       //! Inherit constructors from FileOperation (@see FileOperation)
0261       //------------------------------------------------------------------------
0262       using ZipOperation<ZipReadFromImpl, HasHndl, Resp<ChunkInfo>, Arg<std::string>,
0263           Arg<uint64_t>, Arg<uint32_t>, Arg<void*>>::ZipOperation;
0264 
0265       //------------------------------------------------------------------------
0266       //! Argument indexes in the args tuple
0267       //------------------------------------------------------------------------
0268       enum { FileNameArg, OffsetArg, SizeArg, BufferArg };
0269 
0270       //------------------------------------------------------------------------
0271       //! @return : name of the operation (@see Operation)
0272       //------------------------------------------------------------------------
0273       std::string ToString()
0274       {
0275         return "ZipReadFrom";
0276       }
0277 
0278     protected:
0279 
0280       //------------------------------------------------------------------------
0281       //! RunImpl operation (@see Operation)
0282       //!
0283       //! @param params :  container with parameters forwarded from
0284       //!                  previous operation
0285       //! @return       :  status of the operation
0286       //------------------------------------------------------------------------
0287       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0288       {
0289         std::string &fn = std::get<FileNameArg>( this->args ).Get();
0290         uint64_t     offset  = std::get<OffsetArg>( this->args ).Get();
0291         uint32_t     size    = std::get<SizeArg>( this->args ).Get();
0292         void        *buffer  = std::get<BufferArg>( this->args ).Get();
0293         uint16_t     timeout = pipelineTimeout < this->timeout ?
0294                             pipelineTimeout : this->timeout;
0295         return this->zip->ReadFrom( fn, offset, size, buffer, handler, timeout );
0296       }
0297   };
0298 
0299   //----------------------------------------------------------------------------
0300   //! Factory for creating ArchiveReadImpl objects
0301   //----------------------------------------------------------------------------
0302   inline ZipReadFromImpl<false> ReadFrom( Ctx<ZipArchive> zip, Arg<std::string> fn,
0303                                   Arg<uint64_t> offset, Arg<uint32_t> size,
0304                                   Arg<void*> buffer, uint16_t timeout = 0 )
0305   {
0306     return ZipReadFromImpl<false>( std::move( zip ), std::move( fn ), std::move( offset ),
0307                                    std::move( size ), std::move( buffer ) ).Timeout( timeout );
0308   }
0309 
0310 
0311   //----------------------------------------------------------------------------
0312   //! Write operation (@see ZipOperation)
0313   //----------------------------------------------------------------------------
0314   template<bool HasHndl>
0315   class ZipWriteImpl: public ZipOperation<ZipWriteImpl, HasHndl, Resp<void>,
0316       Arg<uint32_t>, Arg<const void*>>
0317   {
0318     public:
0319 
0320       //------------------------------------------------------------------------
0321       //! Inherit constructors from FileOperation (@see FileOperation)
0322       //------------------------------------------------------------------------
0323       using ZipOperation<ZipWriteImpl, HasHndl, Resp<void>, Arg<uint32_t>,
0324                          Arg<const void*>>::ZipOperation;
0325 
0326       //------------------------------------------------------------------------
0327       //! Argument indexes in the args tuple
0328       //------------------------------------------------------------------------
0329       enum { SizeArg, BufferArg };
0330 
0331       //------------------------------------------------------------------------
0332       //! @return : name of the operation (@see Operation)
0333       //------------------------------------------------------------------------
0334       std::string ToString()
0335       {
0336         return "ZipWrite";
0337       }
0338 
0339     protected:
0340 
0341       //------------------------------------------------------------------------
0342       //! RunImpl operation (@see Operation)
0343       //!
0344       //! @param params :  container with parameters forwarded from
0345       //!                  previous operation
0346       //! @return       :  status of the operation
0347       //------------------------------------------------------------------------
0348       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0349       {
0350         uint32_t    size    = std::get<SizeArg>( this->args ).Get();
0351         const void *buffer  = std::get<BufferArg>( this->args ).Get();
0352         uint16_t    timeout = pipelineTimeout < this->timeout ?
0353                               pipelineTimeout : this->timeout;
0354         return this->zip->Write( size, buffer, handler, timeout );
0355       }
0356   };
0357 
0358   //----------------------------------------------------------------------------
0359   //! Factory for creating ArchiveReadImpl objects
0360   //----------------------------------------------------------------------------
0361   inline ZipWriteImpl<false> Write( Ctx<ZipArchive> zip, Arg<uint32_t> size, Arg<const void*> buffer,
0362                                     uint16_t timeout = 0 )
0363   {
0364     return ZipWriteImpl<false>( std::move( zip ), std::move( size ),
0365                                 std::move( buffer ) ).Timeout( timeout );
0366   }
0367 
0368 
0369   //----------------------------------------------------------------------------
0370   //! AppendFile operation (@see ZipOperation)
0371   //----------------------------------------------------------------------------
0372   template<bool HasHndl>
0373   class AppendFileImpl: public ZipOperation<AppendFileImpl, HasHndl, Resp<void>,
0374       Arg<std::string>, Arg<uint32_t>, Arg<uint32_t>, Arg<const void*>>
0375   {
0376     public:
0377 
0378       //------------------------------------------------------------------------
0379       //! Inherit constructors from FileOperation (@see FileOperation)
0380       //------------------------------------------------------------------------
0381       using ZipOperation<AppendFileImpl, HasHndl, Resp<void>, Arg<std::string>,
0382           Arg<uint32_t>, Arg<uint32_t>, Arg<const void*>>::ZipOperation;
0383 
0384       //------------------------------------------------------------------------
0385       //! Argument indexes in the args tuple
0386       //------------------------------------------------------------------------
0387       enum { FnArg, CrcArg, SizeArg, BufferArg };
0388 
0389       //------------------------------------------------------------------------
0390       //! @return : name of the operation (@see Operation)
0391       //------------------------------------------------------------------------
0392       std::string ToString()
0393       {
0394         return "AppendFile";
0395       }
0396 
0397     protected:
0398 
0399       //------------------------------------------------------------------------
0400       //! RunImpl operation (@see Operation)
0401       //!
0402       //! @param params :  container with parameters forwarded from
0403       //!                  previous operation
0404       //! @return       :  status of the operation
0405       //------------------------------------------------------------------------
0406       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0407       {
0408         std::string &fn      = std::get<FnArg>( this->args ).Get();
0409         uint32_t     crc32   = std::get<CrcArg>( this->args ).Get();
0410         uint32_t     size    = std::get<SizeArg>( this->args ).Get();
0411         const void  *buffer  = std::get<BufferArg>( this->args ).Get();
0412         uint16_t     timeout = pipelineTimeout < this->timeout ?
0413                               pipelineTimeout : this->timeout;
0414         return this->zip->AppendFile( fn, crc32, size, buffer, handler, timeout );
0415       }
0416   };
0417 
0418   //----------------------------------------------------------------------------
0419   //! Factory for creating ArchiveReadImpl objects
0420   //----------------------------------------------------------------------------
0421   inline AppendFileImpl<false> AppendFile( Ctx<ZipArchive> zip, Arg<std::string> fn,
0422                                            Arg<uint32_t> crc32, Arg<uint32_t> size,
0423                                            Arg<const void*> buffer, uint16_t timeout = 0 )
0424   {
0425     return AppendFileImpl<false>( std::move( zip ), std::move( fn ), std::move( crc32 ),
0426                                   std::move( size ), std::move( buffer ) ).Timeout( timeout );
0427   }
0428 
0429 
0430   //----------------------------------------------------------------------------
0431   //! CloseFile operation (@see ZipOperation)
0432   //----------------------------------------------------------------------------
0433   template<bool HasHndl>
0434   class CloseFileImpl: public ZipOperation<CloseFileImpl, HasHndl, Resp<void>>
0435   {
0436     public:
0437 
0438       //------------------------------------------------------------------------
0439       //! Inherit constructors from FileOperation (@see FileOperation)
0440       //------------------------------------------------------------------------
0441       using ZipOperation<CloseFileImpl, HasHndl, Resp<void>>::ZipOperation;
0442 
0443       //------------------------------------------------------------------------
0444       //! @return : name of the operation (@see Operation)
0445       //------------------------------------------------------------------------
0446       std::string ToString()
0447       {
0448         return "ZipCloseFile";
0449       }
0450 
0451     private:
0452 
0453       //------------------------------------------------------------------------
0454       // this is not an async operation so we don't need a handler
0455       //------------------------------------------------------------------------
0456       using ZipOperation<CloseFileImpl, HasHndl, Resp<void>>::operator>>;
0457 
0458     protected:
0459 
0460       //------------------------------------------------------------------------
0461       //! RunImpl operation (@see Operation)
0462       //!
0463       //! @param params :  container with parameters forwarded from
0464       //!                  previous operation
0465       //! @return       :  status of the operation
0466       //------------------------------------------------------------------------
0467       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0468       {
0469         XRootDStatus st = this->zip->CloseFile();
0470         if( !st.IsOK() ) return st;
0471         handler->HandleResponse( new XRootDStatus(), nullptr );
0472         return XRootDStatus();
0473       }
0474   };
0475   typedef CloseFileImpl<false> CloseFile;
0476 
0477 
0478   //----------------------------------------------------------------------------
0479   //! ZipStat operation (@see ZipOperation)
0480   //----------------------------------------------------------------------------
0481   template<bool HasHndl>
0482   class ZipStatImpl: public ZipOperation<ZipStatImpl, HasHndl, Resp<StatInfo>>
0483   {
0484     public:
0485 
0486       //------------------------------------------------------------------------
0487       //! Inherit constructors from FileOperation (@see FileOperation)
0488       //------------------------------------------------------------------------
0489       using ZipOperation<ZipStatImpl, HasHndl, Resp<StatInfo>>::ZipOperation;
0490 
0491       //------------------------------------------------------------------------
0492       //! @return : name of the operation (@see Operation)
0493       //------------------------------------------------------------------------
0494       std::string ToString()
0495       {
0496         return "ZipStat";
0497       }
0498 
0499     protected:
0500 
0501       //------------------------------------------------------------------------
0502       //! RunImpl operation (@see Operation)
0503       //!
0504       //! @param params :  container with parameters forwarded from
0505       //!                  previous operation
0506       //! @return       :  status of the operation
0507       //------------------------------------------------------------------------
0508       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0509       {
0510         StatInfo *info = nullptr;
0511         XRootDStatus st = this->zip->Stat( info );
0512         if( !st.IsOK() ) return st;
0513         AnyObject *rsp = new AnyObject();
0514         rsp->Set( info );
0515         handler->HandleResponse( new XRootDStatus(), rsp );
0516         return XRootDStatus();
0517       }
0518   };
0519 
0520   //----------------------------------------------------------------------------
0521   //! Factory for creating ZipStatImpl objects
0522   //----------------------------------------------------------------------------
0523   inline ZipStatImpl<false> Stat( Ctx<ZipArchive> zip )
0524   {
0525     return ZipStatImpl<false>( std::move( zip ) );
0526   }
0527 
0528 
0529   //----------------------------------------------------------------------------
0530   //! ZipList operation (@see ZipOperation)
0531   //----------------------------------------------------------------------------
0532   template<bool HasHndl>
0533   class ZipListImpl: public ZipOperation<ZipListImpl, HasHndl, Resp<DirectoryList>>
0534   {
0535     public:
0536 
0537       //------------------------------------------------------------------------
0538       //! Inherit constructors from FileOperation (@see FileOperation)
0539       //------------------------------------------------------------------------
0540       using ZipOperation<ZipListImpl, HasHndl, Resp<DirectoryList>>::ZipOperation;
0541 
0542       //------------------------------------------------------------------------
0543       //! @return : name of the operation (@see Operation)
0544       //------------------------------------------------------------------------
0545       std::string ToString()
0546       {
0547         return "ZipStat";
0548       }
0549 
0550     protected:
0551 
0552       //------------------------------------------------------------------------
0553       //! RunImpl operation (@see Operation)
0554       //!
0555       //! @param params :  container with parameters forwarded from
0556       //!                  previous operation
0557       //! @return       :  status of the operation
0558       //------------------------------------------------------------------------
0559       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0560       {
0561         DirectoryList *list = nullptr;
0562         XRootDStatus st = this->zip->List( list );
0563         if( !st.IsOK() ) return st;
0564         AnyObject *rsp = new AnyObject();
0565         rsp->Set( list );
0566         handler->HandleResponse( new XRootDStatus(), rsp );
0567         return XRootDStatus();
0568       }
0569   };
0570 
0571   //----------------------------------------------------------------------------
0572   //! Factory for creating ZipStatImpl objects
0573   //----------------------------------------------------------------------------
0574   inline ZipListImpl<false> List( Ctx<ZipArchive> zip )
0575   {
0576     return ZipListImpl<false>( std::move( zip ) );
0577   }
0578 
0579 
0580   //----------------------------------------------------------------------------
0581   //! CloseArchive operation (@see ZipOperation)
0582   //----------------------------------------------------------------------------
0583   template<bool HasHndl>
0584   class CloseArchiveImpl: public ZipOperation<CloseArchiveImpl, HasHndl, Resp<void>>
0585   {
0586     public:
0587 
0588       //------------------------------------------------------------------------
0589       //! Inherit constructors from FileOperation (@see FileOperation)
0590       //------------------------------------------------------------------------
0591       using ZipOperation<CloseArchiveImpl, HasHndl, Resp<void>>::ZipOperation;
0592 
0593       //------------------------------------------------------------------------
0594       //! @return : name of the operation (@see Operation)
0595       //------------------------------------------------------------------------
0596       std::string ToString()
0597       {
0598         return "ZipClose";
0599       }
0600 
0601     protected:
0602 
0603       //------------------------------------------------------------------------
0604       //! RunImpl operation (@see Operation)
0605       //!
0606       //! @param params :  container with parameters forwarded from
0607       //!                  previous operation
0608       //! @return       :  status of the operation
0609       //------------------------------------------------------------------------
0610       XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout )
0611       {
0612         uint16_t timeout = pipelineTimeout < this->timeout ?
0613                            pipelineTimeout : this->timeout;
0614         return this->zip->CloseArchive( handler, timeout );
0615       }
0616   };
0617 
0618   //----------------------------------------------------------------------------
0619   //! Factory for creating CloseFileImpl objects
0620   //----------------------------------------------------------------------------
0621   inline CloseArchiveImpl<false> CloseArchive( Ctx<ZipArchive> zip, uint16_t timeout = 0 )
0622   {
0623     return CloseArchiveImpl<false>( std::move( zip ) ).Timeout( timeout );
0624   }
0625 
0626 }
0627 
0628 #endif /* SRC_XRDCL_XRDCLZIPOPERATIONS_HH_ */