![]() |
|
|||
File indexing completed on 2025-03-13 09:31:04
0001 //------------------------------------------------------------------------------ 0002 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN) 0003 // Author: Lukasz Janyst <ljanyst@cern.ch> 0004 //------------------------------------------------------------------------------ 0005 // This file is part of the XRootD software suite. 0006 // 0007 // XRootD is free software: you can redistribute it and/or modify 0008 // it under the terms of the GNU Lesser General Public License as published by 0009 // the Free Software Foundation, either version 3 of the License, or 0010 // (at your option) any later version. 0011 // 0012 // XRootD is distributed in the hope that it will be useful, 0013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 // GNU General Public License for more details. 0016 // 0017 // You should have received a copy of the GNU Lesser General Public License 0018 // along with XRootD. If not, see <http://www.gnu.org/licenses/>. 0019 // 0020 // In applying this licence, CERN does not waive the privileges and immunities 0021 // granted to it by virtue of its status as an Intergovernmental Organization 0022 // or submit itself to any jurisdiction. 0023 //------------------------------------------------------------------------------ 0024 0025 #ifndef __XRD_CL_FILE_HH__ 0026 #define __XRD_CL_FILE_HH__ 0027 0028 #include "XrdCl/XrdClFileSystem.hh" 0029 #include "XrdCl/XrdClXRootDResponses.hh" 0030 #include "XrdCl/XrdClOptional.hh" 0031 #include "XrdOuc/XrdOucCompiler.hh" 0032 #include <cstdint> 0033 #include <string> 0034 #include <vector> 0035 #include <sys/uio.h> 0036 0037 namespace XrdCl 0038 { 0039 struct FileImpl; 0040 class FilePlugIn; 0041 0042 //---------------------------------------------------------------------------- 0043 //! A file 0044 //---------------------------------------------------------------------------- 0045 class File 0046 { 0047 public: 0048 0049 enum VirtRedirect 0050 { 0051 EnableVirtRedirect, 0052 DisableVirtRedirect 0053 }; 0054 0055 //------------------------------------------------------------------------ 0056 //! Constructor 0057 //------------------------------------------------------------------------ 0058 File( bool enablePlugIns = true ); 0059 0060 //------------------------------------------------------------------------ 0061 //! Constructor 0062 //------------------------------------------------------------------------ 0063 File( VirtRedirect virtRedirect, bool enablePlugIns = true ); 0064 0065 //------------------------------------------------------------------------ 0066 //! Destructor 0067 //------------------------------------------------------------------------ 0068 virtual ~File(); 0069 0070 //------------------------------------------------------------------------ 0071 //! Open the file pointed to by the given URL - async 0072 //! 0073 //! @param url url of the file to be opened 0074 //! @param flags OpenFlags::Flags 0075 //! @param mode Access::Mode for new files, 0 otherwise 0076 //! @param handler handler to be notified about the status of the operation 0077 //! @param timeout timeout value, if 0 the environment default will be 0078 //! used 0079 //! @return status of the operation 0080 //------------------------------------------------------------------------ 0081 XRootDStatus Open( const std::string &url, 0082 OpenFlags::Flags flags, 0083 Access::Mode mode, 0084 ResponseHandler *handler, 0085 uint16_t timeout = 0 ) 0086 XRD_WARN_UNUSED_RESULT; 0087 0088 //------------------------------------------------------------------------ 0089 //! Open the file pointed to by the given URL - sync 0090 //! 0091 //! @param url url of the file to be opened 0092 //! @param flags OpenFlags::Flags 0093 //! @param mode Access::Mode for new files, 0 otherwise 0094 //! @param timeout timeout value, if 0 the environment default will be 0095 //! used 0096 //! @return status of the operation 0097 //------------------------------------------------------------------------ 0098 XRootDStatus Open( const std::string &url, 0099 OpenFlags::Flags flags, 0100 Access::Mode mode = Access::None, 0101 uint16_t timeout = 0 ) 0102 XRD_WARN_UNUSED_RESULT; 0103 0104 //------------------------------------------------------------------------ 0105 //! Close the file - async 0106 //! 0107 //! @param handler handler to be notified about the status of the operation 0108 //! @param timeout timeout value, if 0 the environment default will be 0109 //! used 0110 //! @return status of the operation 0111 //------------------------------------------------------------------------ 0112 XRootDStatus Close( ResponseHandler *handler, 0113 uint16_t timeout = 0 ) 0114 XRD_WARN_UNUSED_RESULT; 0115 0116 //------------------------------------------------------------------------ 0117 //! Close the file - sync 0118 //! 0119 //! @param timeout timeout value, if 0 the environment default will be 0120 //! used 0121 //! @return status of the operation 0122 //------------------------------------------------------------------------ 0123 XRootDStatus Close( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; 0124 0125 //------------------------------------------------------------------------ 0126 //! Obtain status information for this file - async 0127 //! 0128 //! @param force do not use the cached information, force re-stating 0129 //! @param handler handler to be notified when the response arrives, 0130 //! the response parameter will hold a StatInfo object 0131 //! if the procedure is successful 0132 //! @param timeout timeout value, if 0 the environment default will 0133 //! be used 0134 //! @return status of the operation 0135 //------------------------------------------------------------------------ 0136 XRootDStatus Stat( bool force, 0137 ResponseHandler *handler, 0138 uint16_t timeout = 0 ) 0139 XRD_WARN_UNUSED_RESULT; 0140 0141 //------------------------------------------------------------------------ 0142 //! Obtain status information for this file - sync 0143 //! 0144 //! @param force do not use the cached information, force re-stating 0145 //! @param response the response (to be deleted by the user) 0146 //! @param timeout timeout value, if 0 the environment default will 0147 //! be used 0148 //! @return status of the operation 0149 //------------------------------------------------------------------------ 0150 XRootDStatus Stat( bool force, 0151 StatInfo *&response, 0152 uint16_t timeout = 0 ) 0153 XRD_WARN_UNUSED_RESULT; 0154 0155 0156 //------------------------------------------------------------------------ 0157 //! Read a data chunk at a given offset - async 0158 //! 0159 //! @param offset offset from the beginning of the file 0160 //! @param size number of bytes to be read 0161 //! @param buffer a pointer to a buffer big enough to hold the data 0162 //! or 0 if the buffer should be allocated by the system 0163 //! @param handler handler to be notified when the response arrives, 0164 //! the response parameter will hold a ChunkInfo object if 0165 //! the procedure was successful 0166 //! @param timeout timeout value, if 0 the environment default will be 0167 //! used 0168 //! @return status of the operation 0169 //------------------------------------------------------------------------ 0170 XRootDStatus Read( uint64_t offset, 0171 uint32_t size, 0172 void *buffer, 0173 ResponseHandler *handler, 0174 uint16_t timeout = 0 ) 0175 XRD_WARN_UNUSED_RESULT; 0176 0177 //------------------------------------------------------------------------ 0178 //! Read a data chunk at a given offset - sync 0179 //! 0180 //! @param offset offset from the beginning of the file 0181 //! @param size number of bytes to be read 0182 //! @param buffer a pointer to a buffer big enough to hold the data 0183 //! @param bytesRead number of bytes actually read 0184 //! @param timeout timeout value, if 0 the environment default will be 0185 //! used 0186 //! @return status of the operation 0187 //------------------------------------------------------------------------ 0188 XRootDStatus Read( uint64_t offset, 0189 uint32_t size, 0190 void *buffer, 0191 uint32_t &bytesRead, 0192 uint16_t timeout = 0 ) 0193 XRD_WARN_UNUSED_RESULT; 0194 0195 //------------------------------------------------------------------------ 0196 //! Read number of pages at a given offset - async 0197 //! 0198 //! @param offset offset from the beginning of the file 0199 //! @param size buffer size, at least 1 page big (4KB) 0200 //! @param buffer a pointer to a buffer big enough to hold the data 0201 //! @param handler handler to be notified when the response arrives, 0202 //! the response parameter will hold a PageInfo object if 0203 //! the procedure was successful 0204 //! @param timeout timeout value, if 0 the environment default will be 0205 //! used 0206 //! @return status of the operation 0207 //------------------------------------------------------------------------ 0208 XRootDStatus PgRead( uint64_t offset, 0209 uint32_t size, 0210 void *buffer, 0211 ResponseHandler *handler, 0212 uint16_t timeout = 0 ) 0213 XRD_WARN_UNUSED_RESULT; 0214 0215 //------------------------------------------------------------------------ 0216 //! Read a data chunk at a given offset - sync 0217 //! 0218 //! @param offset offset from the beginning of the file 0219 //! @param size buffer size, at least 1 page big (4KB) 0220 //! @param buffer a pointer to a buffer big enough to hold the data 0221 //! @param cksums crc32c checksum for each read 4KB page 0222 //! @param bytesRead number of bytes actually read 0223 //! @param timeout timeout value, if 0 the environment default will be 0224 //! used 0225 //! @return status of the operation 0226 //------------------------------------------------------------------------ 0227 XRootDStatus PgRead( uint64_t offset, 0228 uint32_t size, 0229 void *buffer, 0230 std::vector<uint32_t> &cksums, 0231 uint32_t &bytesRead, 0232 uint16_t timeout = 0 ) 0233 XRD_WARN_UNUSED_RESULT; 0234 0235 //------------------------------------------------------------------------ 0236 //! Write a data chunk at a given offset - async 0237 //! The call interprets and returns the server response, which may be 0238 //! either a success or a failure, it does not contain the number 0239 //! of bytes that were actually written. 0240 //! 0241 //! @param offset offset from the beginning of the file 0242 //! @param size number of bytes to be written 0243 //! @param buffer a pointer to the buffer holding the data to be written 0244 //! @param handler handler to be notified when the response arrives 0245 //! @param timeout timeout value, if 0 the environment default will be 0246 //! used 0247 //! @return status of the operation 0248 //------------------------------------------------------------------------ 0249 XRootDStatus Write( uint64_t offset, 0250 uint32_t size, 0251 const void *buffer, 0252 ResponseHandler *handler, 0253 uint16_t timeout = 0 ) 0254 XRD_WARN_UNUSED_RESULT; 0255 0256 //------------------------------------------------------------------------ 0257 //! Write a data chunk at a given offset - sync 0258 //! The call interprets and returns the server response, which may be 0259 //! either a success or a failure, it does not contain the number 0260 //! of bytes that were actually written. 0261 //! 0262 //! @param offset offset from the beginning of the file 0263 //! @param size number of bytes to be written 0264 //! @param buffer a pointer to the buffer holding the data to be 0265 //! written 0266 //! @param timeout timeout value, if 0 the environment default will 0267 //! be used 0268 //! @return status of the operation 0269 //------------------------------------------------------------------------ 0270 XRootDStatus Write( uint64_t offset, 0271 uint32_t size, 0272 const void *buffer, 0273 uint16_t timeout = 0 ) 0274 XRD_WARN_UNUSED_RESULT; 0275 0276 //------------------------------------------------------------------------ 0277 //! Write a data chunk at a given offset - async 0278 //! 0279 //! @param offset offset from the beginning of the file 0280 //! @param buffer r-value reference to Buffer object, in this case XrdCl 0281 //! runtime takes ownership of the buffer 0282 //! @param handler handler to be notified when the response arrives 0283 //! @param timeout timeout value, if 0 the environment default will be 0284 //! used 0285 //! @return status of the operation 0286 //------------------------------------------------------------------------ 0287 XRootDStatus Write( uint64_t offset, 0288 Buffer &&buffer, 0289 ResponseHandler *handler, 0290 uint16_t timeout = 0 ); 0291 0292 //------------------------------------------------------------------------ 0293 //! Write a data chunk at a given offset - sync 0294 //! 0295 //! @param offset offset from the beginning of the file 0296 //! @param buffer r-value reference to Buffer object, in this case XrdCl 0297 //! runtime takes ownership of the buffer 0298 //! @param timeout timeout value, if 0 the environment default will be 0299 //! used 0300 //! @return status of the operation 0301 //------------------------------------------------------------------------ 0302 XRootDStatus Write( uint64_t offset, 0303 Buffer &&buffer, 0304 uint16_t timeout = 0 ); 0305 0306 //------------------------------------------------------------------------ 0307 //! Write a data from a given file descriptor at a given offset - async 0308 //! 0309 //! @param offset offset from the beginning of the file 0310 //! @param size number of bytes to be written 0311 //! @param fdoff offset of the data to be written from the file descriptor 0312 //! (optional, if not provided will copy data from the file 0313 //! descriptor at the current cursor position) 0314 //! @param fd file descriptor open for reading 0315 //! @param handler handler to be notified when the response arrives 0316 //! @param timeout timeout value, if 0 the environment default will be 0317 //! used 0318 //! @return status of the operation 0319 //------------------------------------------------------------------------ 0320 XRootDStatus Write( uint64_t offset, 0321 uint32_t size, 0322 Optional<uint64_t> fdoff, 0323 int fd, 0324 ResponseHandler *handler, 0325 uint16_t timeout = 0 ); 0326 0327 //------------------------------------------------------------------------ 0328 //! Write a data from a given file descriptor at a given offset - sync 0329 //! 0330 //! @param offset offset from the beginning of the file 0331 //! @param size number of bytes to be written 0332 //! @param fdoff offset of the data to be written from the file descriptor 0333 //! (optional, if not provided will copy data from the file 0334 //! descriptor at the current cursor position) 0335 //! @param fd file descriptor open for reading 0336 //! @param timeout timeout value, if 0 the environment default will be 0337 //! used 0338 //! @return status of the operation 0339 //------------------------------------------------------------------------ 0340 XRootDStatus Write( uint64_t offset, 0341 uint32_t size, 0342 Optional<uint64_t> fdoff, 0343 int fd, 0344 uint16_t timeout = 0 ); 0345 0346 //------------------------------------------------------------------------ 0347 //! Write number of pages at a given offset - async 0348 //! 0349 //! @param offset offset from the beginning of the file 0350 //! @param size buffer size 0351 //! @param buffer a pointer to a buffer holding data pages 0352 //! @param cksums the crc32c checksums for each 4KB page 0353 //! @param handler handler to be notified when the response arrives 0354 //! @param timeout timeout value, if 0 the environment default will be 0355 //! used 0356 //! @return status of the operation 0357 //------------------------------------------------------------------------ 0358 XRootDStatus PgWrite( uint64_t offset, 0359 uint32_t size, 0360 const void *buffer, 0361 std::vector<uint32_t> &cksums, 0362 ResponseHandler *handler, 0363 uint16_t timeout = 0 ) 0364 XRD_WARN_UNUSED_RESULT; 0365 0366 //------------------------------------------------------------------------ 0367 //! Write number of pages at a given offset - sync 0368 //! 0369 //! @param offset offset from the beginning of the file 0370 //! @param size buffer size 0371 //! @param buffer a pointer to a buffer holding data pages 0372 //! @param cksums the crc32c checksums for each 4KB page 0373 //! @param timeout timeout value, if 0 the environment default will be 0374 //! used 0375 //! @return status of the operation 0376 //------------------------------------------------------------------------ 0377 XRootDStatus PgWrite( uint64_t offset, 0378 uint32_t size, 0379 const void *buffer, 0380 std::vector<uint32_t> &cksums, 0381 uint16_t timeout = 0 ) 0382 XRD_WARN_UNUSED_RESULT; 0383 0384 //------------------------------------------------------------------------ 0385 //! Commit all pending disk writes - async 0386 //! 0387 //! @param handler handler to be notified when the response arrives 0388 //! @param timeout timeout value, if 0 the environment default will be 0389 //! used 0390 //! @return status of the operation 0391 //------------------------------------------------------------------------ 0392 XRootDStatus Sync( ResponseHandler *handler, 0393 uint16_t timeout = 0 ) 0394 XRD_WARN_UNUSED_RESULT; 0395 0396 0397 //------------------------------------------------------------------------ 0398 //! Commit all pending disk writes - sync 0399 //! 0400 //! @param timeout timeout value, if 0 the environment default will be 0401 //! used 0402 //! @return status of the operation 0403 //------------------------------------------------------------------------ 0404 XRootDStatus Sync( uint16_t timeout = 0 ) XRD_WARN_UNUSED_RESULT; 0405 0406 //------------------------------------------------------------------------ 0407 //! Truncate the file to a particular size - async 0408 //! 0409 //! @param size desired size of the file 0410 //! @param handler handler to be notified when the response arrives 0411 //! @param timeout timeout value, if 0 the environment default will be 0412 //! used 0413 //! @return status of the operation 0414 //------------------------------------------------------------------------ 0415 XRootDStatus Truncate( uint64_t size, 0416 ResponseHandler *handler, 0417 uint16_t timeout = 0 ) 0418 XRD_WARN_UNUSED_RESULT; 0419 0420 0421 //------------------------------------------------------------------------ 0422 //! Truncate the file to a particular size - sync 0423 //! 0424 //! @param size desired size of the file 0425 //! @param timeout timeout value, if 0 the environment default will be 0426 //! used 0427 //! @return status of the operation 0428 //------------------------------------------------------------------------ 0429 XRootDStatus Truncate( uint64_t size, 0430 uint16_t timeout = 0 ) 0431 XRD_WARN_UNUSED_RESULT; 0432 0433 //------------------------------------------------------------------------ 0434 //! Read scattered data chunks in one operation - async 0435 //! 0436 //! @param chunks list of the chunks to be read and buffers to put 0437 //! the data in. The default maximum chunk size is 0438 //! 2097136 bytes and the default maximum number 0439 //! of chunks per request is 1024. The server 0440 //! may be queried using FileSystem::Query for the 0441 //! actual settings. 0442 //! @param buffer if zero the buffer pointers in the chunk list 0443 //! will be used, otherwise it needs to point to a 0444 //! buffer big enough to hold the requested data 0445 //! @param handler handler to be notified when the response arrives 0446 //! @param timeout timeout value, if 0 then the environment default 0447 //! will be used 0448 //! @return status of the operation 0449 //------------------------------------------------------------------------ 0450 XRootDStatus VectorRead( const ChunkList &chunks, 0451 void *buffer, 0452 ResponseHandler *handler, 0453 uint16_t timeout = 0 ) 0454 XRD_WARN_UNUSED_RESULT; 0455 0456 //------------------------------------------------------------------------ 0457 //! Read scattered data chunks in one operation - sync 0458 //! 0459 //! @param chunks list of the chunks to be read and buffers to put 0460 //! the data in. The default maximum chunk size is 0461 //! 2097136 bytes and the default maximum number 0462 //! of chunks per request is 1024. The server 0463 //! may be queried using FileSystem::Query for the 0464 //! actual settings. 0465 //! @param buffer if zero the buffer pointers in the chunk list 0466 //! will be used, otherwise it needs to point to a 0467 //! buffer big enough to hold the requested data 0468 //! @param vReadInfo buffer size and chunk information 0469 //! @param timeout timeout value, if 0 then the environment default 0470 //! will be used 0471 //! @return status of the operation 0472 //------------------------------------------------------------------------ 0473 XRootDStatus VectorRead( const ChunkList &chunks, 0474 void *buffer, 0475 VectorReadInfo *&vReadInfo, 0476 uint16_t timeout = 0 ) 0477 XRD_WARN_UNUSED_RESULT; 0478 0479 //------------------------------------------------------------------------ 0480 //! Write scattered data chunks in one operation - async 0481 //! 0482 //! @param chunks list of the chunks to be written. 0483 //! @param handler handler to be notified when the response arrives 0484 //! @param timeout timeout value, if 0 then the environment default 0485 //! will be used 0486 //! @return status of the operation 0487 //------------------------------------------------------------------------ 0488 XRootDStatus VectorWrite( const ChunkList &chunks, 0489 ResponseHandler *handler, 0490 uint16_t timeout = 0 ) 0491 XRD_WARN_UNUSED_RESULT; 0492 0493 //------------------------------------------------------------------------ 0494 //! Write scattered data chunks in one operation - sync 0495 //! 0496 //! @param chunks list of the chunks to be written. 0497 //! @param timeout timeout value, if 0 then the environment default 0498 //! will be used 0499 //! @return status of the operation 0500 //------------------------------------------------------------------------ 0501 XRootDStatus VectorWrite( const ChunkList &chunks, 0502 uint16_t timeout = 0 ) 0503 XRD_WARN_UNUSED_RESULT; 0504 0505 //------------------------------------------------------------------------ 0506 //! Write scattered buffers in one operation - async 0507 //! 0508 //! @param offset offset from the beginning of the file 0509 //! @param iov list of the buffers to be written 0510 //! @param iovcnt number of buffers 0511 //! @param handler handler to be notified when the response arrives 0512 //! @param timeout timeout value, if 0 then the environment default 0513 //! will be used 0514 //! @return status of the operation 0515 //------------------------------------------------------------------------ 0516 XRootDStatus WriteV( uint64_t offset, 0517 const struct iovec *iov, 0518 int iovcnt, 0519 ResponseHandler *handler, 0520 uint16_t timeout = 0 ); 0521 0522 //------------------------------------------------------------------------ 0523 //! Write scattered buffers in one operation - sync 0524 //! 0525 //! @param offset offset from the beginning of the file 0526 //! @param iov list of the buffers to 0527 //! @param iovcnt number of buffers 0528 //! @param timeout timeout value, if 0 then the environment default 0529 //! will be used 0530 //! @return status of the operation 0531 //------------------------------------------------------------------------ 0532 XRootDStatus WriteV( uint64_t offset, 0533 const struct iovec *iov, 0534 int iovcnt, 0535 uint16_t timeout = 0 ); 0536 0537 //------------------------------------------------------------------------ 0538 //! Read data into scattered buffers in one operation - async 0539 //! 0540 //! @param offset offset from the beginning of the file 0541 //! @param iov list of the buffers to be written 0542 //! @param iovcnt number of buffers 0543 //! @param handler handler to be notified when the response arrives 0544 //! @param timeout timeout value, if 0 then the environment default 0545 //! will be used 0546 //! @return status of the operation 0547 //------------------------------------------------------------------------ 0548 XRootDStatus ReadV( uint64_t offset, 0549 struct iovec *iov, 0550 int iovcnt, 0551 ResponseHandler *handler, 0552 uint16_t timeout = 0 ); 0553 0554 //------------------------------------------------------------------------ 0555 //! Read data into scattered buffers in one operation - sync 0556 //! 0557 //! @param offset offset from the beginning of the file 0558 //! @param iov list of the buffers to be written 0559 //! @param iovcnt number of buffers 0560 //! @param bytesRead number of bytes actually read 0561 //! @param timeout timeout value, if 0 then the environment default 0562 //! will be used 0563 //! @return status of the operation 0564 //------------------------------------------------------------------------ 0565 XRootDStatus ReadV( uint64_t offset, 0566 struct iovec *iov, 0567 int iovcnt, 0568 uint32_t &bytesRead, 0569 uint16_t timeout = 0 ); 0570 0571 //------------------------------------------------------------------------ 0572 //! Performs a custom operation on an open file, server implementation 0573 //! dependent - async 0574 //! 0575 //! @param arg query argument 0576 //! @param handler handler to be notified when the response arrives, 0577 //! the response parameter will hold a Buffer object 0578 //! if the procedure is successful 0579 //! @param timeout timeout value, if 0 the environment default will 0580 //! be used 0581 //! @return status of the operation 0582 //------------------------------------------------------------------------ 0583 XRootDStatus Fcntl( const Buffer &arg, 0584 ResponseHandler *handler, 0585 uint16_t timeout = 0 ) 0586 XRD_WARN_UNUSED_RESULT; 0587 0588 //------------------------------------------------------------------------ 0589 //! Performs a custom operation on an open file, server implementation 0590 //! dependent - sync 0591 //! 0592 //! @param arg query argument 0593 //! @param response the response (to be deleted by the user) 0594 //! @param timeout timeout value, if 0 the environment default will 0595 //! be used 0596 //! @return status of the operation 0597 //------------------------------------------------------------------------ 0598 XRootDStatus Fcntl( const Buffer &arg, 0599 Buffer *&response, 0600 uint16_t timeout = 0 ) 0601 XRD_WARN_UNUSED_RESULT; 0602 0603 //------------------------------------------------------------------------ 0604 //! Get access token to a file - async 0605 //! 0606 //! @param handler handler to be notified when the response arrives, 0607 //! the response parameter will hold a Buffer object 0608 //! if the procedure is successful 0609 //! @param timeout timeout value, if 0 the environment default will 0610 //! be used 0611 //! @return status of the operation 0612 //------------------------------------------------------------------------ 0613 XRootDStatus Visa( ResponseHandler *handler, 0614 uint16_t timeout = 0 ) 0615 XRD_WARN_UNUSED_RESULT; 0616 0617 //------------------------------------------------------------------------ 0618 //! Get access token to a file - sync 0619 //! 0620 //! @param visa the access token (to be deleted by the user) 0621 //! @param timeout timeout value, if 0 the environment default will 0622 //! be used 0623 //! @return status of the operation 0624 //------------------------------------------------------------------------ 0625 XRootDStatus Visa( Buffer *&visa, 0626 uint16_t timeout = 0 ) 0627 XRD_WARN_UNUSED_RESULT; 0628 0629 //------------------------------------------------------------------------ 0630 //! Set extended attributes - async 0631 //! 0632 //! @param attrs : list of extended attributes to set 0633 //! @param handler : handler to be notified when the response arrives, 0634 //! the response parameter will hold a std::vector of 0635 //! XAttrStatus objects 0636 //! @param timeout : timeout value, if 0 the environment default will 0637 //! be used 0638 //! 0639 //! @return : status of the operation 0640 //------------------------------------------------------------------------ 0641 XRootDStatus SetXAttr( const std::vector<xattr_t> &attrs, 0642 ResponseHandler *handler, 0643 uint16_t timeout = 0 ); 0644 0645 //------------------------------------------------------------------------ 0646 //! Set extended attributes - sync 0647 //! 0648 //! @param attrs : list of extended attributes to set 0649 //! @param result : result of the operation 0650 //! @param timeout : timeout value, if 0 the environment default will 0651 //! be used 0652 //! 0653 //! @return : status of the operation 0654 //------------------------------------------------------------------------ 0655 XRootDStatus SetXAttr( const std::vector<xattr_t> &attrs, 0656 std::vector<XAttrStatus> &result, 0657 uint16_t timeout = 0 ); 0658 0659 //------------------------------------------------------------------------ 0660 //! Get extended attributes - async 0661 //! 0662 //! @param attrs : list of extended attributes to get 0663 //! @param handler : handler to be notified when the response arrives, 0664 //! the response parameter will hold a std::vector of 0665 //! XAttr objects 0666 //! @param timeout : timeout value, if 0 the environment default will 0667 //! be used 0668 //! 0669 //! @return : status of the operation 0670 //------------------------------------------------------------------------ 0671 XRootDStatus GetXAttr( const std::vector<std::string> &attrs, 0672 ResponseHandler *handler, 0673 uint16_t timeout = 0 ); 0674 0675 //------------------------------------------------------------------------ 0676 //! Get extended attributes - sync 0677 //! 0678 //! @param attrs : list of extended attributes to get 0679 //! @param result : result of the operation 0680 //! @param timeout : timeout value, if 0 the environment default will 0681 //! be used 0682 //! 0683 //! @return : status of the operation 0684 //------------------------------------------------------------------------ 0685 XRootDStatus GetXAttr( const std::vector<std::string> &attrs, 0686 std::vector<XAttr> &result, 0687 uint16_t timeout = 0 ); 0688 0689 //------------------------------------------------------------------------ 0690 //! Delete extended attributes - async 0691 //! 0692 //! @param attrs : list of extended attributes to set 0693 //! @param handler : handler to be notified when the response arrives, 0694 //! the response parameter will hold a std::vector of 0695 //! XAttrStatus objects 0696 //! @param timeout : timeout value, if 0 the environment default will 0697 //! be used 0698 //! 0699 //! @return : status of the operation 0700 //------------------------------------------------------------------------ 0701 XRootDStatus DelXAttr( const std::vector<std::string> &attrs, 0702 ResponseHandler *handler, 0703 uint16_t timeout = 0 ); 0704 0705 //------------------------------------------------------------------------ 0706 //! Delete extended attributes - sync 0707 //! 0708 //! @param attrs : list of extended attributes to set 0709 //! @param result : result of the operation 0710 //! @param timeout : timeout value, if 0 the environment default will 0711 //! be used 0712 //! 0713 //! @return : status of the operation 0714 //------------------------------------------------------------------------ 0715 XRootDStatus DelXAttr( const std::vector<std::string> &attrs, 0716 std::vector<XAttrStatus> &result, 0717 uint16_t timeout = 0 ); 0718 0719 //------------------------------------------------------------------------ 0720 //! List extended attributes - async 0721 //! 0722 //! @param handler : handler to be notified when the response arrives, 0723 //! the response parameter will hold a std::vector of 0724 //! XAttr objects 0725 //! @param timeout : timeout value, if 0 the environment default will 0726 //! be used 0727 //! 0728 //! @return : status of the operation 0729 //------------------------------------------------------------------------ 0730 XRootDStatus ListXAttr( ResponseHandler *handler, 0731 uint16_t timeout = 0 ); 0732 0733 //------------------------------------------------------------------------ 0734 //! List extended attributes - sync 0735 //! 0736 //! @param result : result of the operation 0737 //! @param timeout : timeout value, if 0 the environment default will 0738 //! be used 0739 //! 0740 //! @return : status of the operation 0741 //------------------------------------------------------------------------ 0742 XRootDStatus ListXAttr( std::vector<XAttr> &result, 0743 uint16_t timeout = 0 ); 0744 0745 //------------------------------------------------------------------------ 0746 //! Try different data server 0747 //! 0748 //! @param timeout : timeout value, if 0 the environment default will 0749 //! be used 0750 //! 0751 //! @return : status of the operation 0752 //------------------------------------------------------------------------ 0753 XRootDStatus TryOtherServer( uint16_t timeout = 0 ); 0754 0755 //------------------------------------------------------------------------ 0756 //! Check if the file is open 0757 //------------------------------------------------------------------------ 0758 bool IsOpen() const; 0759 0760 //------------------------------------------------------------------------ 0761 //! Check if the file is using an encrypted connection 0762 //------------------------------------------------------------------------ 0763 bool IsSecure() const; 0764 0765 //------------------------------------------------------------------------ 0766 //! Set file property 0767 //! 0768 //! File properties: 0769 //! ReadRecovery [true/false] - enable/disable read recovery 0770 //! WriteRecovery [true/false] - enable/disable write recovery 0771 //! FollowRedirects [true/false] - enable/disable following redirections 0772 //! BundledClose [true/false] - enable/disable bundled close 0773 //------------------------------------------------------------------------ 0774 bool SetProperty( const std::string &name, const std::string &value ); 0775 0776 //------------------------------------------------------------------------ 0777 //! Get file property 0778 //! 0779 //! @see File::SetProperty for property list 0780 //! 0781 //! Read-only properties: 0782 //! DataServer [string] - the data server the file is accessed at 0783 //! LastURL [string] - final file URL with all the cgi information 0784 //------------------------------------------------------------------------ 0785 bool GetProperty( const std::string &name, std::string &value ) const; 0786 0787 private: 0788 0789 template<bool HasHndl> 0790 friend class CheckpointImpl; 0791 0792 template<bool HasHndl> 0793 friend class ChkptWrtImpl; 0794 0795 template <bool HasHndl> 0796 friend class ChkptWrtVImpl; 0797 0798 //------------------------------------------------------------------------ 0799 //! Create a checkpoint - async 0800 //! 0801 //! @param handler : handler to be notified when the response arrives, 0802 //! the response parameter will hold a std::vector of 0803 //! XAttr objects 0804 //! @param timeout : timeout value, if 0 the environment default will 0805 //! be used 0806 //! 0807 //! @return : status of the operation 0808 //------------------------------------------------------------------------ 0809 XRootDStatus Checkpoint( kXR_char code, 0810 ResponseHandler *handler, 0811 uint16_t timeout = 0 ); 0812 0813 //------------------------------------------------------------------------ 0814 //! Checkpointed write - async 0815 //! 0816 //! @param offset offset from the beginning of the file 0817 //! @param size number of bytes to be written 0818 //! @param buffer a pointer to the buffer holding the data to be written 0819 //! @param handler handler to be notified when the response arrives 0820 //! @param timeout timeout value, if 0 the environment default will be 0821 //! used 0822 //! @return status of the operation 0823 //------------------------------------------------------------------------ 0824 XRootDStatus ChkptWrt( uint64_t offset, 0825 uint32_t size, 0826 const void *buffer, 0827 ResponseHandler *handler, 0828 uint16_t timeout = 0 ); 0829 0830 //------------------------------------------------------------------------ 0831 //! Checkpointed WriteV - async 0832 //! 0833 //! @param offset offset from the beginning of the file 0834 //! @param iov list of the buffers to be written 0835 //! @param iovcnt number of buffers 0836 //! @param handler handler to be notified when the response arrives 0837 //! @param timeout timeout value, if 0 then the environment default 0838 //! will be used 0839 //! @return status of the operation 0840 //------------------------------------------------------------------------ 0841 XRootDStatus ChkptWrtV( uint64_t offset, 0842 const struct iovec *iov, 0843 int iovcnt, 0844 ResponseHandler *handler, 0845 uint16_t timeout = 0 ); 0846 0847 FileImpl *pImpl; 0848 FilePlugIn *pPlugIn; 0849 bool pEnablePlugIns; 0850 }; 0851 } 0852 0853 #endif // __XRD_CL_FILE_HH__
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |