|
||||
File indexing completed on 2025-01-19 10:10:59
0001 //------------------------------------------------------------------------------ 0002 // Copyright (c) 2011-2017 by European Organization for Nuclear Research (CERN) 0003 // Author: Krzysztof Jamrog <krzysztof.piotr.jamrog@cern.ch>, 0004 // Michal Simon <michal.simon@cern.ch> 0005 //------------------------------------------------------------------------------ 0006 // This file is part of the XRootD software suite. 0007 // 0008 // XRootD is free software: you can redistribute it and/or modify 0009 // it under the terms of the GNU Lesser General Public License as published by 0010 // the Free Software Foundation, either version 3 of the License, or 0011 // (at your option) any later version. 0012 // 0013 // XRootD is distributed in the hope that it will be useful, 0014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 0015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0016 // GNU General Public License for more details. 0017 // 0018 // You should have received a copy of the GNU Lesser General Public License 0019 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 0020 // 0021 // In applying this licence, CERN does not waive the privileges and immunities 0022 // granted to it by virtue of its status as an Intergovernmental Organization 0023 // or submit itself to any jurisdiction. 0024 //------------------------------------------------------------------------------ 0025 0026 #ifndef __XRD_CL_FILE_SYSTEM_OPERATIONS_HH__ 0027 #define __XRD_CL_FILE_SYSTEM_OPERATIONS_HH__ 0028 0029 #include "XrdCl/XrdClFileSystem.hh" 0030 #include "XrdCl/XrdClOperations.hh" 0031 #include "XrdCl/XrdClOperationHandlers.hh" 0032 #include "XrdCl/XrdClCtx.hh" 0033 0034 namespace XrdCl 0035 { 0036 0037 //---------------------------------------------------------------------------- 0038 //! Base class for all file system releated operations 0039 //! 0040 //! @arg Derived : the class that derives from this template (CRTP) 0041 //! @arg HasHndl : true if operation has a handler, false otherwise 0042 //! @arg Args : operation arguments 0043 //---------------------------------------------------------------------------- 0044 template<template<bool> class Derived, bool HasHndl, typename Response, typename ... Args> 0045 class FileSystemOperation: public ConcreteOperation<Derived, HasHndl, Response, Args...> 0046 { 0047 0048 template<template<bool> class, bool, typename, typename ...> friend class FileSystemOperation; 0049 0050 public: 0051 //------------------------------------------------------------------------ 0052 //! Constructor 0053 //! 0054 //! @param fs : file system on which the operation will be performed 0055 //! @param args : file operation arguments 0056 //------------------------------------------------------------------------ 0057 FileSystemOperation( Ctx<FileSystem> fs, Args... args): ConcreteOperation<Derived, 0058 false, Response, Args...>( std::move( args )... ), filesystem( std::move( fs ) ) 0059 { 0060 } 0061 0062 //------------------------------------------------------------------------ 0063 //! Move constructor from other states 0064 //! 0065 //! @arg from : state from which the object is being converted 0066 //! 0067 //! @param op : the object that is being converted 0068 //------------------------------------------------------------------------ 0069 template<bool from> 0070 FileSystemOperation( FileSystemOperation<Derived, from, Response, Args...> && op ): 0071 ConcreteOperation<Derived, HasHndl, Response, Args...>( std::move( op ) ), filesystem( op.filesystem ) 0072 { 0073 } 0074 0075 //------------------------------------------------------------------------ 0076 //! Destructor 0077 //------------------------------------------------------------------------ 0078 virtual ~FileSystemOperation() 0079 { 0080 } 0081 0082 protected: 0083 0084 //------------------------------------------------------------------------ 0085 //! The file system object itself. 0086 //------------------------------------------------------------------------ 0087 Ctx<FileSystem> filesystem; 0088 }; 0089 0090 //---------------------------------------------------------------------------- 0091 //! Locate operation (@see FileSystemOperation) 0092 //---------------------------------------------------------------------------- 0093 template<bool HasHndl> 0094 class LocateImpl: public FileSystemOperation<LocateImpl, HasHndl, Resp<LocationInfo>, 0095 Arg<std::string>, Arg<OpenFlags::Flags>> 0096 { 0097 public: 0098 0099 //------------------------------------------------------------------------ 0100 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0101 //------------------------------------------------------------------------ 0102 using FileSystemOperation<LocateImpl, HasHndl, Resp<LocationInfo>, Arg<std::string>, 0103 Arg<OpenFlags::Flags>>::FileSystemOperation; 0104 0105 //------------------------------------------------------------------------ 0106 //! Argument indexes in the args tuple 0107 //------------------------------------------------------------------------ 0108 enum { PathArg, FlagsArg }; 0109 0110 //------------------------------------------------------------------------ 0111 //! @return : name of the operation (@see Operation) 0112 //------------------------------------------------------------------------ 0113 std::string ToString() 0114 { 0115 return "Locate"; 0116 } 0117 0118 protected: 0119 0120 //------------------------------------------------------------------------ 0121 //! RunImpl operation (@see Operation) 0122 //! 0123 //! @param params : container with parameters forwarded from 0124 //! previous operation 0125 //! @return : status of the operation 0126 //------------------------------------------------------------------------ 0127 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0128 { 0129 std::string &path = std::get<PathArg>( this->args ).Get(); 0130 OpenFlags::Flags flags = std::get<FlagsArg>( this->args ).Get(); 0131 uint16_t timeout = pipelineTimeout < this->timeout ? 0132 pipelineTimeout : this->timeout; 0133 return this->filesystem->Locate( path, flags, handler, timeout ); 0134 } 0135 }; 0136 typedef LocateImpl<false> Locate; 0137 0138 //---------------------------------------------------------------------------- 0139 //! DeepLocate operation (@see FileSystemOperation) 0140 //---------------------------------------------------------------------------- 0141 template<bool HasHndl> 0142 class DeepLocateImpl: public FileSystemOperation<DeepLocateImpl, HasHndl, 0143 Resp<LocationInfo>, Arg<std::string>, Arg<OpenFlags::Flags>> 0144 { 0145 public: 0146 0147 //------------------------------------------------------------------------ 0148 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0149 //------------------------------------------------------------------------ 0150 using FileSystemOperation<DeepLocateImpl, HasHndl, Resp<LocationInfo>, Arg<std::string>, 0151 Arg<OpenFlags::Flags>>::FileSystemOperation; 0152 0153 //------------------------------------------------------------------------ 0154 //! Argument indexes in the args tuple 0155 //------------------------------------------------------------------------ 0156 enum { PathArg, FlagsArg }; 0157 0158 //------------------------------------------------------------------------ 0159 //! @return : name of the operation (@see Operation) 0160 //------------------------------------------------------------------------ 0161 std::string ToString() 0162 { 0163 return "DeepLocate"; 0164 } 0165 0166 protected: 0167 0168 //------------------------------------------------------------------------ 0169 //! RunImpl operation (@see Operation) 0170 //! 0171 //! @param params : container with parameters forwarded from 0172 //! previous operation 0173 //! @return : status of the operation 0174 //------------------------------------------------------------------------ 0175 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0176 { 0177 std::string &path = std::get<PathArg>( this->args ).Get(); 0178 OpenFlags::Flags flags = std::get<FlagsArg>( this->args ).Get(); 0179 uint16_t timeout = pipelineTimeout < this->timeout ? 0180 pipelineTimeout : this->timeout; 0181 return this->filesystem->DeepLocate( path, flags, handler, timeout ); 0182 } 0183 }; 0184 typedef DeepLocateImpl<false> DeepLocate; 0185 0186 //---------------------------------------------------------------------------- 0187 //! Mv operation (@see FileSystemOperation) 0188 //---------------------------------------------------------------------------- 0189 template<bool HasHndl> 0190 class MvImpl: public FileSystemOperation<MvImpl, HasHndl, Resp<void>, Arg<std::string>, 0191 Arg<std::string>> 0192 { 0193 public: 0194 0195 //------------------------------------------------------------------------ 0196 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0197 //------------------------------------------------------------------------ 0198 using FileSystemOperation<MvImpl, HasHndl, Resp<void>, Arg<std::string>, 0199 Arg<std::string>>::FileSystemOperation; 0200 0201 //------------------------------------------------------------------------ 0202 //! Argument indexes in the args tuple 0203 //------------------------------------------------------------------------ 0204 enum { SourceArg, DestArg }; 0205 0206 //------------------------------------------------------------------------ 0207 //! @return : name of the operation (@see Operation) 0208 //------------------------------------------------------------------------ 0209 std::string ToString() 0210 { 0211 return "Mv"; 0212 } 0213 0214 protected: 0215 0216 //------------------------------------------------------------------------ 0217 //! RunImpl operation (@see Operation) 0218 //! 0219 //! @param params : container with parameters forwarded from 0220 //! previous operation 0221 //! @return : status of the operation 0222 //------------------------------------------------------------------------ 0223 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0224 { 0225 std::string &source = std::get<SourceArg>( this->args ).Get(); 0226 std::string &dest = std::get<DestArg>( this->args ).Get(); 0227 uint16_t timeout = pipelineTimeout < this->timeout ? 0228 pipelineTimeout : this->timeout; 0229 return this->filesystem->Mv( source, dest, handler, timeout ); 0230 } 0231 }; 0232 typedef MvImpl<false> Mv; 0233 0234 //---------------------------------------------------------------------------- 0235 //! Query operation (@see FileSystemOperation) 0236 //---------------------------------------------------------------------------- 0237 template<bool HasHndl> 0238 class QueryImpl: public FileSystemOperation<QueryImpl, HasHndl, Resp<Buffer>, 0239 Arg<QueryCode::Code>, Arg<Buffer>> 0240 { 0241 public: 0242 0243 //------------------------------------------------------------------------ 0244 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0245 //------------------------------------------------------------------------ 0246 using FileSystemOperation<QueryImpl, HasHndl, Resp<Buffer>, Arg<QueryCode::Code>, 0247 Arg<Buffer>>::FileSystemOperation; 0248 0249 //------------------------------------------------------------------------ 0250 //! Argument indexes in the args tuple 0251 //------------------------------------------------------------------------ 0252 enum { QueryCodeArg, BufferArg }; 0253 0254 //------------------------------------------------------------------------ 0255 //! @return : name of the operation (@see Operation) 0256 //------------------------------------------------------------------------ 0257 std::string ToString() 0258 { 0259 return "Query"; 0260 } 0261 0262 protected: 0263 0264 //------------------------------------------------------------------------ 0265 //! RunImpl operation (@see Operation) 0266 //! 0267 //! @param params : container with parameters forwarded from 0268 //! previous operation 0269 //! @return : status of the operation 0270 //------------------------------------------------------------------------ 0271 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0272 { 0273 QueryCode::Code queryCode = std::get<QueryCodeArg>( this->args ).Get(); 0274 const Buffer &buffer( std::get<BufferArg>( this->args ).Get() ); 0275 uint16_t timeout = pipelineTimeout < this->timeout ? 0276 pipelineTimeout : this->timeout; 0277 return this->filesystem->Query( queryCode, buffer, handler, timeout ); 0278 } 0279 }; 0280 typedef QueryImpl<false> Query; 0281 0282 //---------------------------------------------------------------------------- 0283 //! Truncate operation (@see FileSystemOperation) 0284 //---------------------------------------------------------------------------- 0285 template<bool HasHndl> 0286 class TruncateFsImpl: public FileSystemOperation<TruncateFsImpl, HasHndl, Resp<void>, 0287 Arg<std::string>, Arg<uint64_t>> 0288 { 0289 public: 0290 0291 //------------------------------------------------------------------------ 0292 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0293 //------------------------------------------------------------------------ 0294 using FileSystemOperation<TruncateFsImpl, HasHndl, Resp<void>, Arg<std::string>, 0295 Arg<uint64_t>>::FileSystemOperation; 0296 0297 //------------------------------------------------------------------------ 0298 //! Argument indexes in the args tuple 0299 //------------------------------------------------------------------------ 0300 enum { PathArg, SizeArg }; 0301 0302 //------------------------------------------------------------------------ 0303 //! @return : name of the operation (@see Operation) 0304 //------------------------------------------------------------------------ 0305 std::string ToString() 0306 { 0307 return "Truncate"; 0308 } 0309 0310 protected: 0311 0312 //------------------------------------------------------------------------ 0313 //! RunImpl operation (@see Operation) 0314 //! 0315 //! @param params : container with parameters forwarded from 0316 //! previous operation 0317 //! @return : status of the operation 0318 //------------------------------------------------------------------------ 0319 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0320 { 0321 std::string &path = std::get<PathArg>( this->args ).Get(); 0322 uint64_t size = std::get<SizeArg>( this->args ).Get(); 0323 uint16_t timeout = pipelineTimeout < this->timeout ? 0324 pipelineTimeout : this->timeout; 0325 return this->filesystem->Truncate( path, size, handler, timeout ); 0326 } 0327 }; 0328 0329 inline TruncateFsImpl<false> Truncate( Ctx<FileSystem> fs, Arg<std::string> path, Arg<uint64_t> size ) 0330 { 0331 return TruncateFsImpl<false>( std::move( fs ), std::move( path ), std::move( size ) ); 0332 } 0333 0334 0335 //---------------------------------------------------------------------------- 0336 //! Rm operation (@see FileSystemOperation) 0337 //---------------------------------------------------------------------------- 0338 template<bool HasHndl> 0339 class RmImpl: public FileSystemOperation<RmImpl, HasHndl, Resp<void>, Arg<std::string>> 0340 { 0341 public: 0342 0343 //------------------------------------------------------------------------ 0344 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0345 //------------------------------------------------------------------------ 0346 using FileSystemOperation<RmImpl, HasHndl, Resp<void>, Arg<std::string>>::FileSystemOperation; 0347 0348 //------------------------------------------------------------------------ 0349 //! Argument indexes in the args tuple 0350 //------------------------------------------------------------------------ 0351 enum { PathArg }; 0352 0353 //------------------------------------------------------------------------ 0354 //! @return : name of the operation (@see Operation) 0355 //------------------------------------------------------------------------ 0356 std::string ToString() 0357 { 0358 return "Rm"; 0359 } 0360 0361 protected: 0362 0363 //------------------------------------------------------------------------ 0364 //! RunImpl operation (@see Operation) 0365 //! 0366 //! @param params : container with parameters forwarded from 0367 //! previous operation 0368 //! @return : status of the operation 0369 //------------------------------------------------------------------------ 0370 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0371 { 0372 std::string &path = std::get<PathArg>( this->args ).Get(); 0373 uint16_t timeout = pipelineTimeout < this->timeout ? 0374 pipelineTimeout : this->timeout; 0375 return this->filesystem->Rm( path, handler, timeout ); 0376 } 0377 }; 0378 typedef RmImpl<false> Rm; 0379 0380 //---------------------------------------------------------------------------- 0381 //! MkDir operation (@see FileSystemOperation) 0382 //---------------------------------------------------------------------------- 0383 template<bool HasHndl> 0384 class MkDirImpl: public FileSystemOperation<MkDirImpl, HasHndl, Resp<void>, 0385 Arg<std::string>, Arg<MkDirFlags::Flags>, Arg<Access::Mode>> 0386 { 0387 public: 0388 0389 //------------------------------------------------------------------------ 0390 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0391 //------------------------------------------------------------------------ 0392 using FileSystemOperation<MkDirImpl, HasHndl, Resp<void>, Arg<std::string>, 0393 Arg<MkDirFlags::Flags>, Arg<Access::Mode>>::FileSystemOperation; 0394 0395 //------------------------------------------------------------------------ 0396 //! Argument indexes in the args tuple 0397 //------------------------------------------------------------------------ 0398 enum { PathArg, FlagsArg, ModeArg }; 0399 0400 //------------------------------------------------------------------------ 0401 //! @return : name of the operation (@see Operation) 0402 //------------------------------------------------------------------------ 0403 std::string ToString() 0404 { 0405 return "MkDir"; 0406 } 0407 0408 protected: 0409 0410 //------------------------------------------------------------------------ 0411 //! RunImpl operation (@see Operation) 0412 //! 0413 //! @param params : container with parameters forwarded from 0414 //! previous operation 0415 //! @return : status of the operation 0416 //------------------------------------------------------------------------ 0417 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0418 { 0419 std::string &path = std::get<PathArg>( this->args ).Get(); 0420 MkDirFlags::Flags flags = std::get<FlagsArg>( this->args ).Get(); 0421 Access::Mode mode = std::get<ModeArg>( this->args ).Get(); 0422 uint16_t timeout = pipelineTimeout < this->timeout ? 0423 pipelineTimeout : this->timeout; 0424 return this->filesystem->MkDir( path, flags, mode, handler, timeout ); 0425 } 0426 }; 0427 typedef MkDirImpl<false> MkDir; 0428 0429 //---------------------------------------------------------------------------- 0430 //! RmDir operation (@see FileSystemOperation) 0431 //---------------------------------------------------------------------------- 0432 template<bool HasHndl> 0433 class RmDirImpl: public FileSystemOperation<RmDirImpl, HasHndl, Resp<void>, 0434 Arg<std::string>> 0435 { 0436 public: 0437 0438 //------------------------------------------------------------------------ 0439 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0440 //------------------------------------------------------------------------ 0441 using FileSystemOperation<RmDirImpl, HasHndl, Resp<void>, Arg<std::string>>::FileSystemOperation; 0442 0443 //------------------------------------------------------------------------ 0444 //! Argument indexes in the args tuple 0445 //------------------------------------------------------------------------ 0446 enum { PathArg }; 0447 0448 //------------------------------------------------------------------------ 0449 //! @return : name of the operation (@see Operation) 0450 //------------------------------------------------------------------------ 0451 std::string ToString() 0452 { 0453 return "RmDir"; 0454 } 0455 0456 protected: 0457 0458 //------------------------------------------------------------------------ 0459 //! RunImpl operation (@see Operation) 0460 //! 0461 //! @param params : container with parameters forwarded from 0462 //! previous operation 0463 //! @return : status of the operation 0464 //------------------------------------------------------------------------ 0465 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0466 { 0467 std::string &path = std::get<PathArg>( this->args ).Get(); 0468 uint16_t timeout = pipelineTimeout < this->timeout ? 0469 pipelineTimeout : this->timeout; 0470 return this->filesystem->RmDir( path, handler, timeout ); 0471 } 0472 }; 0473 typedef RmDirImpl<false> RmDir; 0474 0475 //---------------------------------------------------------------------------- 0476 //! ChMod operation (@see FileSystemOperation) 0477 //---------------------------------------------------------------------------- 0478 template<bool HasHndl> 0479 class ChModImpl: public FileSystemOperation<ChModImpl, HasHndl, Resp<void>, 0480 Arg<std::string>, Arg<Access::Mode>> 0481 { 0482 public: 0483 0484 //------------------------------------------------------------------------ 0485 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0486 //------------------------------------------------------------------------ 0487 using FileSystemOperation<ChModImpl, HasHndl, Resp<void>, Arg<std::string>, 0488 Arg<Access::Mode>>::FileSystemOperation; 0489 0490 //------------------------------------------------------------------------ 0491 //! Argument indexes in the args tuple 0492 //------------------------------------------------------------------------ 0493 enum { PathArg, ModeArg }; 0494 0495 //------------------------------------------------------------------------ 0496 //! @return : name of the operation (@see Operation) 0497 //------------------------------------------------------------------------ 0498 std::string ToString() 0499 { 0500 return "ChMod"; 0501 } 0502 0503 protected: 0504 0505 //------------------------------------------------------------------------ 0506 //! RunImpl operation (@see Operation) 0507 //! 0508 //! @param params : container with parameters forwarded from 0509 //! previous operation 0510 //! @return : status of the operation 0511 //------------------------------------------------------------------------ 0512 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0513 { 0514 std::string &path = std::get<PathArg>( this->args ).Get(); 0515 Access::Mode mode = std::get<ModeArg>( this->args ).Get(); 0516 uint16_t timeout = pipelineTimeout < this->timeout ? 0517 pipelineTimeout : this->timeout; 0518 return this->filesystem->ChMod( path, mode, handler, timeout ); 0519 } 0520 }; 0521 typedef ChModImpl<false> ChMod; 0522 0523 //---------------------------------------------------------------------------- 0524 //! Ping operation (@see FileSystemOperation) 0525 //---------------------------------------------------------------------------- 0526 template<bool HasHndl> 0527 class PingImpl: public FileSystemOperation<PingImpl, HasHndl, Resp<void>> 0528 { 0529 public: 0530 0531 //------------------------------------------------------------------------ 0532 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0533 //------------------------------------------------------------------------ 0534 using FileSystemOperation<PingImpl, HasHndl, Resp<void>>::FileSystemOperation; 0535 0536 //------------------------------------------------------------------------ 0537 //! @return : name of the operation (@see Operation) 0538 //------------------------------------------------------------------------ 0539 std::string ToString() 0540 { 0541 return "Ping"; 0542 } 0543 0544 protected: 0545 0546 //------------------------------------------------------------------------ 0547 //! RunImpl operation (@see Operation) 0548 //! 0549 //! @param params : container with parameters forwarded from 0550 //! previous operation 0551 //! @return : status of the operation 0552 //------------------------------------------------------------------------ 0553 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0554 { 0555 uint16_t timeout = pipelineTimeout < this->timeout ? 0556 pipelineTimeout : this->timeout; 0557 return this->filesystem->Ping( handler, timeout ); 0558 } 0559 }; 0560 typedef PingImpl<false> Ping; 0561 0562 //---------------------------------------------------------------------------- 0563 //! Stat operation (@see FileSystemOperation) 0564 //---------------------------------------------------------------------------- 0565 template<bool HasHndl> 0566 class StatFsImpl: public FileSystemOperation<StatFsImpl, HasHndl, Resp<StatInfo>, 0567 Arg<std::string>> 0568 { 0569 public: 0570 0571 //------------------------------------------------------------------------ 0572 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0573 //------------------------------------------------------------------------ 0574 using FileSystemOperation<StatFsImpl, HasHndl, Resp<StatInfo>, 0575 Arg<std::string>>::FileSystemOperation; 0576 0577 //------------------------------------------------------------------------ 0578 //! Argument indexes in the args tuple 0579 //------------------------------------------------------------------------ 0580 enum { PathArg }; 0581 0582 //------------------------------------------------------------------------ 0583 //! @return : name of the operation (@see Operation) 0584 //------------------------------------------------------------------------ 0585 std::string ToString() 0586 { 0587 return "Stat"; 0588 } 0589 0590 protected: 0591 0592 //------------------------------------------------------------------------ 0593 //! RunImpl operation (@see Operation) 0594 //! 0595 //! @param params : container with parameters forwarded from 0596 //! previous operation 0597 //! @return : status of the operation 0598 //------------------------------------------------------------------------ 0599 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0600 { 0601 std::string &path = std::get<PathArg>( this->args ).Get(); 0602 uint16_t timeout = pipelineTimeout < this->timeout ? 0603 pipelineTimeout : this->timeout; 0604 return this->filesystem->Stat( path, handler, timeout ); 0605 } 0606 }; 0607 0608 inline StatFsImpl<false> Stat( Ctx<FileSystem> fs, Arg<std::string> path ) 0609 { 0610 return StatFsImpl<false>( std::move( fs ), std::move( path ) ); 0611 } 0612 0613 //---------------------------------------------------------------------------- 0614 //! StatVS operation (@see FileSystemOperation) 0615 //---------------------------------------------------------------------------- 0616 template<bool HasHndl> 0617 class StatVFSImpl: public FileSystemOperation<StatVFSImpl, HasHndl, 0618 Resp<StatInfoVFS>, Arg<std::string>> 0619 { 0620 public: 0621 0622 //------------------------------------------------------------------------ 0623 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0624 //------------------------------------------------------------------------ 0625 using FileSystemOperation<StatVFSImpl, HasHndl, Resp<StatInfoVFS>, 0626 Arg<std::string>>::FileSystemOperation; 0627 0628 //------------------------------------------------------------------------ 0629 //! Argument indexes in the args tuple 0630 //------------------------------------------------------------------------ 0631 enum { PathArg }; 0632 0633 //------------------------------------------------------------------------ 0634 //! @return : name of the operation (@see Operation) 0635 //------------------------------------------------------------------------ 0636 std::string ToString() 0637 { 0638 return "StatVFS"; 0639 } 0640 0641 protected: 0642 0643 //------------------------------------------------------------------------ 0644 //! RunImpl operation (@see Operation) 0645 //! 0646 //! @param params : container with parameters forwarded from 0647 //! previous operation 0648 //! @return : status of the operation 0649 //------------------------------------------------------------------------ 0650 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0651 { 0652 std::string &path = std::get<PathArg>( this->args ).Get(); 0653 uint16_t timeout = pipelineTimeout < this->timeout ? 0654 pipelineTimeout : this->timeout; 0655 return this->filesystem->StatVFS( path, handler, timeout ); 0656 } 0657 }; 0658 typedef StatVFSImpl<false> StatVFS; 0659 0660 //---------------------------------------------------------------------------- 0661 //! Protocol operation (@see FileSystemOperation) 0662 //---------------------------------------------------------------------------- 0663 template<bool HasHndl> 0664 class ProtocolImpl: public FileSystemOperation<ProtocolImpl, HasHndl, 0665 Resp<ProtocolInfo>> 0666 { 0667 public: 0668 0669 //------------------------------------------------------------------------ 0670 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0671 //------------------------------------------------------------------------ 0672 using FileSystemOperation<ProtocolImpl, HasHndl, Resp<ProtocolInfo>>::FileSystemOperation; 0673 0674 //------------------------------------------------------------------------ 0675 //! @return : name of the operation (@see Operation) 0676 //------------------------------------------------------------------------ 0677 std::string ToString() 0678 { 0679 return "Protocol"; 0680 } 0681 0682 protected: 0683 0684 //------------------------------------------------------------------------ 0685 //! RunImpl operation (@see Operation) 0686 //! 0687 //! @param params : container with parameters forwarded from 0688 //! previous operation 0689 //! @return : status of the operation 0690 //------------------------------------------------------------------------ 0691 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0692 { 0693 uint16_t timeout = pipelineTimeout < this->timeout ? 0694 pipelineTimeout : this->timeout; 0695 return this->filesystem->Protocol( handler, timeout ); 0696 } 0697 }; 0698 typedef ProtocolImpl<false> Protocol; 0699 0700 //---------------------------------------------------------------------------- 0701 //! DirList operation (@see FileSystemOperation) 0702 //---------------------------------------------------------------------------- 0703 template<bool HasHndl> 0704 class DirListImpl: public FileSystemOperation<DirListImpl, HasHndl, Resp<DirectoryList>, 0705 Arg<std::string>, Arg<DirListFlags::Flags>> 0706 { 0707 public: 0708 0709 //------------------------------------------------------------------------ 0710 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0711 //------------------------------------------------------------------------ 0712 using FileSystemOperation<DirListImpl, HasHndl, Resp<DirectoryList>, Arg<std::string>, 0713 Arg<DirListFlags::Flags>>::FileSystemOperation; 0714 0715 //------------------------------------------------------------------------ 0716 //! Argument indexes in the args tuple 0717 //------------------------------------------------------------------------ 0718 enum { PathArg, FlagsArg }; 0719 0720 //------------------------------------------------------------------------ 0721 //! @return : name of the operation (@see Operation) 0722 //------------------------------------------------------------------------ 0723 std::string ToString() 0724 { 0725 return "DirList"; 0726 } 0727 0728 protected: 0729 0730 //------------------------------------------------------------------------ 0731 //! RunImpl operation (@see Operation) 0732 //! 0733 //! @param params : container with parameters forwarded from 0734 //! previous operation 0735 //! @return : status of the operation 0736 //------------------------------------------------------------------------ 0737 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0738 { 0739 std::string &path = std::get<PathArg>( this->args ).Get(); 0740 DirListFlags::Flags flags = std::get<FlagsArg>( this->args ).Get(); 0741 uint16_t timeout = pipelineTimeout < this->timeout ? 0742 pipelineTimeout : this->timeout; 0743 return this->filesystem->DirList( path, flags, handler, timeout ); 0744 } 0745 }; 0746 typedef DirListImpl<false> DirList; 0747 0748 //---------------------------------------------------------------------------- 0749 //! SendInfo operation (@see FileSystemOperation) 0750 //---------------------------------------------------------------------------- 0751 template<bool HasHndl> 0752 class SendInfoImpl: public FileSystemOperation<SendInfoImpl, HasHndl, Resp<Buffer>, 0753 Arg<std::string>> 0754 { 0755 public: 0756 0757 //------------------------------------------------------------------------ 0758 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0759 //------------------------------------------------------------------------ 0760 using FileSystemOperation<SendInfoImpl, HasHndl, Resp<Buffer>, 0761 Arg<std::string>>::FileSystemOperation; 0762 0763 //------------------------------------------------------------------------ 0764 //! Argument indexes in the args tuple 0765 //------------------------------------------------------------------------ 0766 enum { InfoArg }; 0767 0768 //------------------------------------------------------------------------ 0769 //! @return : name of the operation (@see Operation) 0770 //------------------------------------------------------------------------ 0771 std::string ToString() 0772 { 0773 return "SendInfo"; 0774 } 0775 0776 protected: 0777 0778 //------------------------------------------------------------------------ 0779 //! RunImpl operation (@see Operation) 0780 //! 0781 //! @param params : container with parameters forwarded from 0782 //! previous operation 0783 //! @return : status of the operation 0784 //------------------------------------------------------------------------ 0785 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0786 { 0787 std::string &info = std::get<InfoArg>( this->args ).Get(); 0788 uint16_t timeout = pipelineTimeout < this->timeout ? 0789 pipelineTimeout : this->timeout; 0790 return this->filesystem->SendInfo( info, handler, timeout ); 0791 } 0792 }; 0793 typedef SendInfoImpl<false> SendInfo; 0794 0795 //---------------------------------------------------------------------------- 0796 //! Prepare operation (@see FileSystemOperation) 0797 //---------------------------------------------------------------------------- 0798 template<bool HasHndl> 0799 class PrepareImpl: public FileSystemOperation<PrepareImpl, HasHndl, Resp<Buffer>, 0800 Arg<std::vector<std::string>>, Arg<PrepareFlags::Flags>, Arg<uint8_t>> 0801 { 0802 public: 0803 0804 //------------------------------------------------------------------------ 0805 //! Inherit constructors from FileSystemOperation (@see FileSystemOperation) 0806 //------------------------------------------------------------------------ 0807 using FileSystemOperation<PrepareImpl, HasHndl, Resp<Buffer>, Arg<std::vector<std::string>>, 0808 Arg<PrepareFlags::Flags>, Arg<uint8_t>>::FileSystemOperation; 0809 0810 //------------------------------------------------------------------------ 0811 //! Argument indexes in the args tuple 0812 //------------------------------------------------------------------------ 0813 enum { FileListArg, FlagsArg, PriorityArg }; 0814 0815 //------------------------------------------------------------------------ 0816 //! @return : name of the operation (@see Operation) 0817 //------------------------------------------------------------------------ 0818 std::string ToString() 0819 { 0820 return "Prepare"; 0821 } 0822 0823 protected: 0824 0825 //------------------------------------------------------------------------ 0826 //! RunImpl operation (@see Operation) 0827 //! 0828 //! @param params : container with parameters forwarded from 0829 //! previous operation 0830 //! @return : status of the operation 0831 //------------------------------------------------------------------------ 0832 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0833 { 0834 std::vector<std::string> &fileList = std::get<FileListArg>( this->args ).Get(); 0835 PrepareFlags::Flags flags = std::get<FlagsArg>( this->args ).Get(); 0836 uint8_t priority = std::get<PriorityArg>( this->args ).Get(); 0837 uint16_t timeout = pipelineTimeout < this->timeout ? 0838 pipelineTimeout : this->timeout; 0839 return this->filesystem->Prepare( fileList, flags, priority, 0840 handler, timeout ); 0841 } 0842 }; 0843 typedef PrepareImpl<false> Prepare; 0844 0845 //---------------------------------------------------------------------------- 0846 //! SetXAttr operation (@see FileOperation) 0847 //---------------------------------------------------------------------------- 0848 template<bool HasHndl> 0849 class SetXAttrFsImpl: public FileSystemOperation<SetXAttrFsImpl, HasHndl, Resp<void>, 0850 Arg<std::string>, Arg<std::string>, Arg<std::string>> 0851 { 0852 public: 0853 0854 //------------------------------------------------------------------------ 0855 //! Inherit constructors from FileOperation (@see FileOperation) 0856 //------------------------------------------------------------------------ 0857 using FileSystemOperation<SetXAttrFsImpl, HasHndl, Resp<void>, Arg<std::string>, 0858 Arg<std::string>, Arg<std::string>>::FileSystemOperation; 0859 0860 //------------------------------------------------------------------------ 0861 //! Argument indexes in the args tuple 0862 //------------------------------------------------------------------------ 0863 enum { PathArg, NameArg, ValueArg }; 0864 0865 //------------------------------------------------------------------------ 0866 //! @return : name of the operation (@see Operation) 0867 //------------------------------------------------------------------------ 0868 std::string ToString() 0869 { 0870 return "SetXAttrFsImpl"; 0871 } 0872 0873 protected: 0874 0875 //------------------------------------------------------------------------ 0876 //! RunImpl operation (@see Operation) 0877 //! 0878 //! @param params : container with parameters forwarded from 0879 //! previous operation 0880 //! @return : status of the operation 0881 //------------------------------------------------------------------------ 0882 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0883 { 0884 std::string &path = std::get<PathArg>( this->args ).Get(); 0885 std::string &name = std::get<NameArg>( this->args ).Get(); 0886 std::string &value = std::get<ValueArg>( this->args ).Get(); 0887 // wrap the arguments with a vector 0888 std::vector<xattr_t> attrs; 0889 attrs.push_back( xattr_t( name, value ) ); 0890 // wrap the PipelineHandler so the response gets unpacked properly 0891 UnpackXAttrStatus *h = new UnpackXAttrStatus( handler ); 0892 uint16_t timeout = pipelineTimeout < this->timeout ? 0893 pipelineTimeout : this->timeout; 0894 XRootDStatus st = this->filesystem->SetXAttr( path, attrs, h, timeout ); 0895 if( !st.IsOK() ) delete h; 0896 return st; 0897 } 0898 }; 0899 0900 //---------------------------------------------------------------------------- 0901 //! Factory for creating SetXAttrFsImpl objects (as there is another SetXAttr 0902 //! in File there would be a clash of typenames). 0903 //---------------------------------------------------------------------------- 0904 inline SetXAttrFsImpl<false> SetXAttr( Ctx<FileSystem> fs, Arg<std::string> path, 0905 Arg<std::string> name, Arg<std::string> value ) 0906 { 0907 return SetXAttrFsImpl<false>( std::move( fs ), std::move( path ), std::move( name ), 0908 std::move( value ) ); 0909 } 0910 0911 //---------------------------------------------------------------------------- 0912 //! SetXAttr bulk operation (@see FileOperation) 0913 //---------------------------------------------------------------------------- 0914 template<bool HasHndl> 0915 class SetXAttrFsBulkImpl: public FileSystemOperation<SetXAttrFsBulkImpl, HasHndl, 0916 Resp<std::vector<XAttrStatus>>, Arg<std::string>, Arg<std::vector<xattr_t>>> 0917 { 0918 public: 0919 0920 //------------------------------------------------------------------------ 0921 //! Inherit constructors from FileOperation (@see FileOperation) 0922 //------------------------------------------------------------------------ 0923 using FileSystemOperation<SetXAttrFsBulkImpl, HasHndl, Resp<std::vector<XAttrStatus>>, 0924 Arg<std::string>, Arg<std::vector<xattr_t>>>::FileSystemOperation; 0925 0926 //------------------------------------------------------------------------ 0927 //! Argument indexes in the args tuple 0928 //------------------------------------------------------------------------ 0929 enum { PathArg, AttrsArg }; 0930 0931 //------------------------------------------------------------------------ 0932 //! @return : name of the operation (@see Operation) 0933 //------------------------------------------------------------------------ 0934 std::string ToString() 0935 { 0936 return "SetXAttrBulkImpl"; 0937 } 0938 0939 0940 protected: 0941 0942 //------------------------------------------------------------------------ 0943 //! RunImpl operation (@see Operation) 0944 //! 0945 //! @return : status of the operation 0946 //------------------------------------------------------------------------ 0947 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 0948 { 0949 std::string &path = std::get<PathArg>( this->args ).Get(); 0950 std::vector<xattr_t> &attrs = std::get<AttrsArg>( this->args ).Get(); 0951 uint16_t timeout = pipelineTimeout < this->timeout ? 0952 pipelineTimeout : this->timeout; 0953 return this->filesystem->SetXAttr( path, attrs, handler, timeout ); 0954 } 0955 }; 0956 0957 //---------------------------------------------------------------------------- 0958 //! Factory for creating SetXAttrFsBulkImpl objects (as there is another SetXAttr 0959 //! in FileSystem there would be a clash of typenames). 0960 //---------------------------------------------------------------------------- 0961 inline SetXAttrFsBulkImpl<false> SetXAttr( Ctx<FileSystem> fs, Arg<std::string> path, 0962 Arg<std::vector<xattr_t>> attrs ) 0963 { 0964 return SetXAttrFsBulkImpl<false>( std::move( fs ), std::move( path ), std::move( attrs ) ); 0965 } 0966 0967 //---------------------------------------------------------------------------- 0968 //! GetXAttr operation (@see FileOperation) 0969 //---------------------------------------------------------------------------- 0970 template<bool HasHndl> 0971 class GetXAttrFsImpl: public FileSystemOperation<GetXAttrFsImpl, HasHndl, Resp<std::string>, 0972 Arg<std::string>, Arg<std::string>> 0973 { 0974 public: 0975 0976 //------------------------------------------------------------------------ 0977 //! Inherit constructors from FileOperation (@see FileOperation) 0978 //------------------------------------------------------------------------ 0979 using FileSystemOperation<GetXAttrFsImpl, HasHndl, Resp<std::string>, 0980 Arg<std::string>, Arg<std::string>>::FileSystemOperation; 0981 0982 //------------------------------------------------------------------------ 0983 //! Argument indexes in the args tuple 0984 //------------------------------------------------------------------------ 0985 enum { PathArg, NameArg }; 0986 0987 //------------------------------------------------------------------------ 0988 //! @return : name of the operation (@see Operation) 0989 //------------------------------------------------------------------------ 0990 std::string ToString() 0991 { 0992 return "GetXAttrFsImpl"; 0993 } 0994 0995 protected: 0996 0997 //------------------------------------------------------------------------ 0998 //! RunImpl operation (@see Operation) 0999 //! 1000 //! @return : status of the operation 1001 //------------------------------------------------------------------------ 1002 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 1003 { 1004 std::string &path = std::get<PathArg>( this->args ).Get(); 1005 std::string &name = std::get<NameArg>( this->args ).Get(); 1006 // wrap the argument with a vector 1007 std::vector<std::string> attrs; 1008 attrs.push_back( name ); 1009 // wrap the PipelineHandler so the response gets unpacked properly 1010 UnpackXAttr *h = new UnpackXAttr( handler ); 1011 uint16_t timeout = pipelineTimeout < this->timeout ? 1012 pipelineTimeout : this->timeout; 1013 XRootDStatus st = this->filesystem->GetXAttr( path, attrs, h, timeout ); 1014 if( !st.IsOK() ) delete h; 1015 return st; 1016 } 1017 }; 1018 1019 //---------------------------------------------------------------------------- 1020 //! Factory for creating GetXAttrFsImpl objects (as there is another GetXAttr 1021 //! in File there would be a clash of typenames). 1022 //---------------------------------------------------------------------------- 1023 inline GetXAttrFsImpl<false> GetXAttr( Ctx<FileSystem> fs, Arg<std::string> path, 1024 Arg<std::string> name ) 1025 { 1026 return GetXAttrFsImpl<false>( std::move( fs ), std::move( path ), std::move( name ) ); 1027 } 1028 1029 //---------------------------------------------------------------------------- 1030 //! GetXAttr bulk operation (@see FileOperation) 1031 //---------------------------------------------------------------------------- 1032 template<bool HasHndl> 1033 class GetXAttrFsBulkImpl: public FileSystemOperation<GetXAttrFsBulkImpl, HasHndl, 1034 Resp<std::vector<XAttr>>, Arg<std::string>, Arg<std::vector<std::string>>> 1035 { 1036 public: 1037 1038 //------------------------------------------------------------------------ 1039 //! Inherit constructors from FileOperation (@see FileOperation) 1040 //------------------------------------------------------------------------ 1041 using FileSystemOperation<GetXAttrFsBulkImpl, HasHndl, Resp<std::vector<XAttr>>, 1042 Arg<std::string>, Arg<std::vector<std::string>>>::FileSystemOperation; 1043 1044 //------------------------------------------------------------------------ 1045 //! Argument indexes in the args tuple 1046 //------------------------------------------------------------------------ 1047 enum { PathArg, NamesArg }; 1048 1049 //------------------------------------------------------------------------ 1050 //! @return : name of the operation (@see Operation) 1051 //------------------------------------------------------------------------ 1052 std::string ToString() 1053 { 1054 return "GetXAttrFsBulkImpl"; 1055 } 1056 1057 1058 protected: 1059 1060 //------------------------------------------------------------------------ 1061 //! RunImpl operation (@see Operation) 1062 //! 1063 //! @return : status of the operation 1064 //------------------------------------------------------------------------ 1065 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 1066 { 1067 std::string &path = std::get<PathArg>( this->args ).Get(); 1068 std::vector<std::string> &attrs = std::get<NamesArg>( this->args ).Get(); 1069 uint16_t timeout = pipelineTimeout < this->timeout ? 1070 pipelineTimeout : this->timeout; 1071 return this->filesystem->GetXAttr( path, attrs, handler, timeout ); 1072 } 1073 }; 1074 1075 //---------------------------------------------------------------------------- 1076 //! Factory for creating GetXAttrFsBulkImpl objects (as there is another GetXAttr in 1077 //! FileSystem there would be a clash of typenames). 1078 //---------------------------------------------------------------------------- 1079 inline GetXAttrFsBulkImpl<false> GetXAttr( Ctx<FileSystem> fs, Arg<std::string> path, 1080 Arg<std::vector<std::string>> attrs ) 1081 { 1082 return GetXAttrFsBulkImpl<false>( std::move( fs ), std::move( path ), std::move( attrs ) ); 1083 } 1084 1085 //---------------------------------------------------------------------------- 1086 //! DelXAttr operation (@see FileOperation) 1087 //---------------------------------------------------------------------------- 1088 template<bool HasHndl> 1089 class DelXAttrFsImpl: public FileSystemOperation<DelXAttrFsImpl, HasHndl, Resp<void>, 1090 Arg<std::string>, Arg<std::string>> 1091 { 1092 public: 1093 1094 //------------------------------------------------------------------------ 1095 //! Inherit constructors from FileOperation (@see FileOperation) 1096 //------------------------------------------------------------------------ 1097 using FileSystemOperation<DelXAttrFsImpl, HasHndl, Resp<void>, Arg<std::string>, 1098 Arg<std::string>>::FileSystemOperation; 1099 1100 //------------------------------------------------------------------------ 1101 //! Argument indexes in the args tuple 1102 //------------------------------------------------------------------------ 1103 enum { PathArg, NameArg }; 1104 1105 //------------------------------------------------------------------------ 1106 //! @return : name of the operation (@see Operation) 1107 //------------------------------------------------------------------------ 1108 std::string ToString() 1109 { 1110 return "DelXAttrFsImpl"; 1111 } 1112 1113 protected: 1114 1115 //------------------------------------------------------------------------ 1116 //! RunImpl operation (@see Operation) 1117 //! 1118 //! @param params : container with parameters forwarded from 1119 //! previous operation 1120 //! @return : status of the operation 1121 //------------------------------------------------------------------------ 1122 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 1123 { 1124 std::string &path = std::get<PathArg>( this->args ).Get(); 1125 std::string &name = std::get<NameArg>( this->args ).Get(); 1126 // wrap the argument with a vector 1127 std::vector<std::string> attrs; 1128 attrs.push_back( name ); 1129 // wrap the PipelineHandler so the response gets unpacked properly 1130 UnpackXAttrStatus *h = new UnpackXAttrStatus( handler ); 1131 uint16_t timeout = pipelineTimeout < this->timeout ? 1132 pipelineTimeout : this->timeout; 1133 XRootDStatus st = this->filesystem->DelXAttr( path, attrs, h, timeout ); 1134 if( !st.IsOK() ) delete h; 1135 return st; 1136 } 1137 }; 1138 1139 //---------------------------------------------------------------------------- 1140 //! Factory for creating DelXAttrFsImpl objects (as there is another DelXAttr 1141 //! in File there would be a clash of typenames). 1142 //---------------------------------------------------------------------------- 1143 inline DelXAttrFsImpl<false> DelXAttr( Ctx<FileSystem> fs, Arg<std::string> path, 1144 Arg<std::string> name ) 1145 { 1146 return DelXAttrFsImpl<false>( std::move( fs ), std::move( path ), std::move( name ) ); 1147 } 1148 1149 //---------------------------------------------------------------------------- 1150 //! DelXAttr bulk operation (@see FileOperation) 1151 //---------------------------------------------------------------------------- 1152 template<bool HasHndl> 1153 class DelXAttrFsBulkImpl: public FileSystemOperation<DelXAttrFsBulkImpl, HasHndl, 1154 Resp<std::vector<XAttrStatus>>, Arg<std::string>, Arg<std::vector<std::string>>> 1155 { 1156 public: 1157 1158 //------------------------------------------------------------------------ 1159 //! Inherit constructors from FileOperation (@see FileOperation) 1160 //------------------------------------------------------------------------ 1161 using FileSystemOperation<DelXAttrFsBulkImpl, HasHndl, Resp<std::vector<XAttrStatus>>, 1162 Arg<std::string>, Arg<std::vector<std::string>>>::FileSystemOperation; 1163 1164 //------------------------------------------------------------------------ 1165 //! Argument indexes in the args tuple 1166 //------------------------------------------------------------------------ 1167 enum { PathArg, NamesArg }; 1168 1169 //------------------------------------------------------------------------ 1170 //! @return : name of the operation (@see Operation) 1171 //------------------------------------------------------------------------ 1172 std::string ToString() 1173 { 1174 return "DelXAttrBulkImpl"; 1175 } 1176 1177 1178 protected: 1179 1180 //------------------------------------------------------------------------ 1181 //! RunImpl operation (@see Operation) 1182 //! 1183 //! @param params : container with parameters forwarded from 1184 //! previous operation 1185 //! @return : status of the operation 1186 //------------------------------------------------------------------------ 1187 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 1188 { 1189 std::string &path = std::get<PathArg>( this->args ).Get(); 1190 std::vector<std::string> &attrs = std::get<NamesArg>( this->args ).Get(); 1191 uint16_t timeout = pipelineTimeout < this->timeout ? 1192 pipelineTimeout : this->timeout; 1193 return this->filesystem->DelXAttr( path, attrs, handler, timeout ); 1194 } 1195 }; 1196 1197 //---------------------------------------------------------------------------- 1198 //! Factory for creating DelXAttrFsBulkImpl objects (as there is another DelXAttr 1199 //! in FileSystem there would be a clash of typenames). 1200 //---------------------------------------------------------------------------- 1201 inline DelXAttrFsBulkImpl<false> DelXAttr( Ctx<FileSystem> fs, Arg<std::string> path, 1202 Arg<std::vector<std::string>> attrs ) 1203 { 1204 return DelXAttrFsBulkImpl<false>( std::move( fs ), std::move( path ), std::move( attrs ) ); 1205 } 1206 1207 //---------------------------------------------------------------------------- 1208 //! ListXAttr bulk operation (@see FileOperation) 1209 //---------------------------------------------------------------------------- 1210 template<bool HasHndl> 1211 class ListXAttrFsImpl: public FileSystemOperation<ListXAttrFsImpl, HasHndl, 1212 Resp<std::vector<XAttr>>, Arg<std::string>> 1213 { 1214 public: 1215 1216 //------------------------------------------------------------------------ 1217 //! Inherit constructors from FileOperation (@see FileOperation) 1218 //------------------------------------------------------------------------ 1219 using FileSystemOperation<ListXAttrFsImpl, HasHndl, Resp<std::vector<XAttr>>, 1220 Arg<std::string>>::FileSystemOperation; 1221 1222 //------------------------------------------------------------------------ 1223 //! Argument indexes in the args tuple 1224 //------------------------------------------------------------------------ 1225 enum { PathArg }; 1226 1227 //------------------------------------------------------------------------ 1228 //! @return : name of the operation (@see Operation) 1229 //------------------------------------------------------------------------ 1230 std::string ToString() 1231 { 1232 return "ListXAttrFsImpl"; 1233 } 1234 1235 protected: 1236 1237 //------------------------------------------------------------------------ 1238 //! RunImpl operation (@see Operation) 1239 //! 1240 //! @param params : container with parameters forwarded from 1241 //! previous operation 1242 //! @return : status of the operation 1243 //------------------------------------------------------------------------ 1244 XRootDStatus RunImpl( PipelineHandler *handler, uint16_t pipelineTimeout ) 1245 { 1246 std::string &path = std::get<PathArg>( this->args ).Get(); 1247 uint16_t timeout = pipelineTimeout < this->timeout ? 1248 pipelineTimeout : this->timeout; 1249 return this->filesystem->ListXAttr( path, handler, timeout ); 1250 } 1251 }; 1252 1253 //---------------------------------------------------------------------------- 1254 //! Factory for creating ListXAttrFsImpl objects (as there is another ListXAttr 1255 //! in FileSystem there would be a clash of typenames). 1256 //---------------------------------------------------------------------------- 1257 inline ListXAttrFsImpl<false> ListXAttr( Ctx<FileSystem> fs, Arg<std::string> path ) 1258 { 1259 return ListXAttrFsImpl<false>( std::move( fs ), std::move( path ) ); 1260 } 1261 } 1262 1263 #endif // __XRD_CL_FILE_SYSTEM_OPERATIONS_HH__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |