xrootd
XrdClFileStateHandler.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
3 // Author: Lukasz Janyst <ljanyst@cern.ch>
4 //------------------------------------------------------------------------------
5 // This file is part of the XRootD software suite.
6 //
7 // XRootD is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU Lesser General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // XRootD is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19 //
20 // In applying this licence, CERN does not waive the privileges and immunities
21 // granted to it by virtue of its status as an Intergovernmental Organization
22 // or submit itself to any jurisdiction.
23 //------------------------------------------------------------------------------
24 
25 #ifndef __XRD_CL_FILE_STATE_HANDLER_HH__
26 #define __XRD_CL_FILE_STATE_HANDLER_HH__
27 
30 #include "XrdCl/XrdClFileSystem.hh"
33 #include "XrdCl/XrdClOptional.hh"
35 #include "XrdSys/XrdSysPthread.hh"
36 #include "XrdSys/XrdSysPageSize.hh"
37 
38 #include <list>
39 #include <set>
40 #include <vector>
41 
42 #include <sys/time.h>
43 #include <sys/uio.h>
44 #include <cstdint>
45 
46 namespace
47 {
48  class PgReadHandler;
49  class PgReadRetryHandler;
50  class PgReadSubstitutionHandler;
51  class OpenHandler;
52 }
53 
54 namespace XrdCl
55 {
56  class Message;
57  class EcHandler;
58 
59  //----------------------------------------------------------------------------
61  //----------------------------------------------------------------------------
62  struct PgReadFlags
63  {
64  //------------------------------------------------------------------------
66  //------------------------------------------------------------------------
67  enum Flags
68  {
69  None = 0, //< Nothing
70  Retry = XrdProto::kXR_pgRetry //< Retry reading currupted page
71 
72  };
73  };
75 
76  //----------------------------------------------------------------------------
78  //----------------------------------------------------------------------------
80  {
81  friend class ::PgReadHandler;
82  friend class ::PgReadRetryHandler;
83  friend class ::PgReadSubstitutionHandler;
84  friend class ::OpenHandler;
85 
86  public:
87  //------------------------------------------------------------------------
89  //------------------------------------------------------------------------
91  {
97  CloseInProgress
98  };
99 
100  //------------------------------------------------------------------------
102  //------------------------------------------------------------------------
104 
105  //------------------------------------------------------------------------
110  //------------------------------------------------------------------------
111  FileStateHandler( bool useVirtRedirector, FilePlugIn *& plugin );
112 
113  //------------------------------------------------------------------------
115  //------------------------------------------------------------------------
117 
118  //------------------------------------------------------------------------
128  //------------------------------------------------------------------------
129  static XRootDStatus Open( std::shared_ptr<FileStateHandler> &self,
130  const std::string &url,
131  uint16_t flags,
132  uint16_t mode,
133  ResponseHandler *handler,
134  uint16_t timeout = 0 );
135 
136  //------------------------------------------------------------------------
143  //------------------------------------------------------------------------
144  static XRootDStatus Close( std::shared_ptr<FileStateHandler> &self,
145  ResponseHandler *handler,
146  uint16_t timeout = 0 );
147 
148  //------------------------------------------------------------------------
158  //------------------------------------------------------------------------
159  static XRootDStatus Stat( std::shared_ptr<FileStateHandler> &self,
160  bool force,
161  ResponseHandler *handler,
162  uint16_t timeout = 0 );
163 
164 
165  //------------------------------------------------------------------------
180  //------------------------------------------------------------------------
181  static XRootDStatus Read( std::shared_ptr<FileStateHandler> &self,
182  uint64_t offset,
183  uint32_t size,
184  void *buffer,
185  ResponseHandler *handler,
186  uint16_t timeout = 0 );
187 
188  //------------------------------------------------------------------------
201  //------------------------------------------------------------------------
202  static XRootDStatus PgRead( std::shared_ptr<FileStateHandler> &self,
203  uint64_t offset,
204  uint32_t size,
205  void *buffer,
206  ResponseHandler *handler,
207  uint16_t timeout = 0 );
208 
209  //------------------------------------------------------------------------
220  //------------------------------------------------------------------------
221  static XRootDStatus PgReadRetry( std::shared_ptr<FileStateHandler> &self,
222  uint64_t offset,
223  uint32_t size,
224  size_t pgnb,
225  void *buffer,
226  PgReadHandler *handler,
227  uint16_t timeout = 0 );
228 
229  //------------------------------------------------------------------------
243  //------------------------------------------------------------------------
244  static XRootDStatus PgReadImpl( std::shared_ptr<FileStateHandler> &self,
245  uint64_t offset,
246  uint32_t size,
247  void *buffer,
248  uint16_t flags,
249  ResponseHandler *handler,
250  uint16_t timeout = 0 );
251 
252  //------------------------------------------------------------------------
262  //------------------------------------------------------------------------
263  static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
264  uint64_t offset,
265  uint32_t size,
266  const void *buffer,
267  ResponseHandler *handler,
268  uint16_t timeout = 0 );
269 
270  //------------------------------------------------------------------------
280  //------------------------------------------------------------------------
281  static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
282  uint64_t offset,
283  Buffer &&buffer,
284  ResponseHandler *handler,
285  uint16_t timeout = 0 );
286 
287  //------------------------------------------------------------------------
300  //------------------------------------------------------------------------
301  static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
302  uint64_t offset,
303  uint32_t size,
304  Optional<uint64_t> fdoff,
305  int fd,
306  ResponseHandler *handler,
307  uint16_t timeout = 0 );
308 
309  //------------------------------------------------------------------------
320  //------------------------------------------------------------------------
321  static XRootDStatus PgWrite( std::shared_ptr<FileStateHandler> &self,
322  uint64_t offset,
323  uint32_t size,
324  const void *buffer,
325  std::vector<uint32_t> &cksums,
326  ResponseHandler *handler,
327  uint16_t timeout = 0 );
328 
329  //------------------------------------------------------------------------
339  //------------------------------------------------------------------------
340  static XRootDStatus PgWriteRetry( std::shared_ptr<FileStateHandler> &self,
341  uint64_t offset,
342  uint32_t size,
343  const void *buffer,
344  uint32_t digest,
345  ResponseHandler *handler,
346  uint16_t timeout = 0 );
347 
348  //------------------------------------------------------------------------
360  //------------------------------------------------------------------------
361  static XRootDStatus PgWriteImpl( std::shared_ptr<FileStateHandler> &self,
362  uint64_t offset,
363  uint32_t size,
364  const void *buffer,
365  std::vector<uint32_t> &cksums,
366  kXR_char flags,
367  ResponseHandler *handler,
368  uint16_t timeout = 0 );
369 
370  //------------------------------------------------------------------------
377  //------------------------------------------------------------------------
378  static XRootDStatus Sync( std::shared_ptr<FileStateHandler> &self,
379  ResponseHandler *handler,
380  uint16_t timeout = 0 );
381 
382  //------------------------------------------------------------------------
390  //------------------------------------------------------------------------
391  static XRootDStatus Truncate( std::shared_ptr<FileStateHandler> &self,
392  uint64_t size,
393  ResponseHandler *handler,
394  uint16_t timeout = 0 );
395 
396  //------------------------------------------------------------------------
405  //------------------------------------------------------------------------
406  static XRootDStatus VectorRead( std::shared_ptr<FileStateHandler> &self,
407  const ChunkList &chunks,
408  void *buffer,
409  ResponseHandler *handler,
410  uint16_t timeout = 0 );
411 
412  //------------------------------------------------------------------------
420  //------------------------------------------------------------------------
421  static XRootDStatus VectorWrite( std::shared_ptr<FileStateHandler> &self,
422  const ChunkList &chunks,
423  ResponseHandler *handler,
424  uint16_t timeout = 0 );
425 
426  //------------------------------------------------------------------------
436  //------------------------------------------------------------------------
437  static XRootDStatus WriteV( std::shared_ptr<FileStateHandler> &self,
438  uint64_t offset,
439  const struct iovec *iov,
440  int iovcnt,
441  ResponseHandler *handler,
442  uint16_t timeout = 0 );
443 
444  //------------------------------------------------------------------------
454  //------------------------------------------------------------------------
455  static XRootDStatus ReadV( std::shared_ptr<FileStateHandler> &self,
456  uint64_t offset,
457  struct iovec *iov,
458  int iovcnt,
459  ResponseHandler *handler,
460  uint16_t timeout = 0 );
461 
462  //------------------------------------------------------------------------
473  //------------------------------------------------------------------------
474  static XRootDStatus Fcntl( std::shared_ptr<FileStateHandler> &self,
475  const Buffer &arg,
476  ResponseHandler *handler,
477  uint16_t timeout = 0 );
478 
479  //------------------------------------------------------------------------
488  //------------------------------------------------------------------------
489  static XRootDStatus Visa( std::shared_ptr<FileStateHandler> &self,
490  ResponseHandler *handler,
491  uint16_t timeout = 0 );
492 
493  //------------------------------------------------------------------------
504  //------------------------------------------------------------------------
505  static XRootDStatus SetXAttr( std::shared_ptr<FileStateHandler> &self,
506  const std::vector<xattr_t> &attrs,
507  ResponseHandler *handler,
508  uint16_t timeout = 0 );
509 
510  //------------------------------------------------------------------------
521  //------------------------------------------------------------------------
522  static XRootDStatus GetXAttr( std::shared_ptr<FileStateHandler> &self,
523  const std::vector<std::string> &attrs,
524  ResponseHandler *handler,
525  uint16_t timeout = 0 );
526 
527  //------------------------------------------------------------------------
538  //------------------------------------------------------------------------
539  static XRootDStatus DelXAttr( std::shared_ptr<FileStateHandler> &self,
540  const std::vector<std::string> &attrs,
541  ResponseHandler *handler,
542  uint16_t timeout = 0 );
543 
544  //------------------------------------------------------------------------
554  //------------------------------------------------------------------------
555  static XRootDStatus ListXAttr( std::shared_ptr<FileStateHandler> &self,
556  ResponseHandler *handler,
557  uint16_t timeout = 0 );
558 
559  //------------------------------------------------------------------------
569  //------------------------------------------------------------------------
570  static XRootDStatus Checkpoint( std::shared_ptr<FileStateHandler> &self,
571  kXR_char code,
572  ResponseHandler *handler,
573  uint16_t timeout = 0 );
574 
575  //------------------------------------------------------------------------
585  //------------------------------------------------------------------------
586  static XRootDStatus ChkptWrt( std::shared_ptr<FileStateHandler> &self,
587  uint64_t offset,
588  uint32_t size,
589  const void *buffer,
590  ResponseHandler *handler,
591  uint16_t timeout = 0 );
592 
593  //------------------------------------------------------------------------
603  //------------------------------------------------------------------------
604  static XRootDStatus ChkptWrtV( std::shared_ptr<FileStateHandler> &self,
605  uint64_t offset,
606  const struct iovec *iov,
607  int iovcnt,
608  ResponseHandler *handler,
609  uint16_t timeout = 0 );
610 
611  //------------------------------------------------------------------------
613  //------------------------------------------------------------------------
614  void OnOpen( const XRootDStatus *status,
615  const OpenInfo *openInfo,
616  const HostList *hostList );
617 
618  //------------------------------------------------------------------------
620  //------------------------------------------------------------------------
621  void OnClose( const XRootDStatus *status );
622 
623  //------------------------------------------------------------------------
625  //------------------------------------------------------------------------
626  static void OnStateError( std::shared_ptr<FileStateHandler> &self,
627  XRootDStatus *status,
628  Message *message,
629  ResponseHandler *userHandler,
630  MessageSendParams &sendParams );
631 
632  //------------------------------------------------------------------------
634  //------------------------------------------------------------------------
635  static void OnStateRedirection( std::shared_ptr<FileStateHandler> &self,
636  const std::string &redirectUrl,
637  Message *message,
638  ResponseHandler *userHandler,
639  MessageSendParams &sendParams );
640 
641  //------------------------------------------------------------------------
643  //------------------------------------------------------------------------
644  static void OnStateResponse( std::shared_ptr<FileStateHandler> &self,
645  XRootDStatus *status,
646  Message *message,
647  AnyObject *response,
648  HostList *hostList );
649 
650  //------------------------------------------------------------------------
652  //------------------------------------------------------------------------
653  bool IsOpen() const;
654 
655  //------------------------------------------------------------------------
657  //------------------------------------------------------------------------
658  inline bool IsSecure() const
659  {
660  return pIsChannelEncrypted;
661  }
662 
663  //------------------------------------------------------------------------
667  //------------------------------------------------------------------------
668  bool SetProperty( const std::string &name, const std::string &value );
669 
670  //------------------------------------------------------------------------
674  //------------------------------------------------------------------------
675  bool GetProperty( const std::string &name, std::string &value ) const;
676 
677  //------------------------------------------------------------------------
679  //------------------------------------------------------------------------
680  void Lock()
681  {
682  pMutex.Lock();
683  }
684 
685  //------------------------------------------------------------------------
687  //------------------------------------------------------------------------
688  void UnLock()
689  {
690  pMutex.UnLock();
691  }
692 
693  //------------------------------------------------------------------------
695  //------------------------------------------------------------------------
696  void Tick( time_t now );
697 
698  //------------------------------------------------------------------------
700  //------------------------------------------------------------------------
701  void TimeOutRequests( time_t now );
702 
703  //------------------------------------------------------------------------
705  //------------------------------------------------------------------------
707 
708  //------------------------------------------------------------------------
710  //------------------------------------------------------------------------
711  static XRootDStatus TryOtherServer( std::shared_ptr<FileStateHandler> &self,
712  uint16_t timeout );
713 
714  private:
715  //------------------------------------------------------------------------
716  // Helper for queuing messages
717  //------------------------------------------------------------------------
718  struct RequestData
719  {
720  RequestData(): request(0), handler(0) {}
722  const MessageSendParams &p ):
723  request(r), handler(h), params(p) {}
727  };
728  typedef std::list<RequestData> RequestList;
729 
730  //------------------------------------------------------------------------
737  //------------------------------------------------------------------------
738  template<typename T>
739  static Status XAttrOperationImpl( std::shared_ptr<FileStateHandler> &self,
740  kXR_char subcode,
741  kXR_char options,
742  const std::vector<T> &attrs,
743  ResponseHandler *handler,
744  uint16_t timeout = 0 );
745 
746  //------------------------------------------------------------------------
748  //------------------------------------------------------------------------
749  static Status SendOrQueue( std::shared_ptr<FileStateHandler> &self,
750  const URL &url,
751  Message *msg,
752  ResponseHandler *handler,
753  MessageSendParams &sendParams );
754 
755  //------------------------------------------------------------------------
757  //------------------------------------------------------------------------
758  bool IsRecoverable( const XRootDStatus &stataus ) const;
759 
760  //------------------------------------------------------------------------
766  //------------------------------------------------------------------------
767  static Status RecoverMessage( std::shared_ptr<FileStateHandler> &self,
768  RequestData rd,
769  bool callbackOnFailure = true );
770 
771  //------------------------------------------------------------------------
773  //------------------------------------------------------------------------
774  static Status RunRecovery( std::shared_ptr<FileStateHandler> &self );
775 
776  //------------------------------------------------------------------------
777  // Send a close and ignore the response
778  //------------------------------------------------------------------------
779  static XRootDStatus SendClose( std::shared_ptr<FileStateHandler> &self,
780  uint16_t timeout );
781 
782  //------------------------------------------------------------------------
784  //------------------------------------------------------------------------
785  bool IsReadOnly() const;
786 
787  //------------------------------------------------------------------------
789  //------------------------------------------------------------------------
790  static XRootDStatus ReOpenFileAtServer( std::shared_ptr<FileStateHandler> &self,
791  const URL &url,
792  uint16_t timeout );
793 
794  //------------------------------------------------------------------------
796  //------------------------------------------------------------------------
798 
799  //------------------------------------------------------------------------
801  //------------------------------------------------------------------------
803 
804  //------------------------------------------------------------------------
806  //------------------------------------------------------------------------
808 
809  //------------------------------------------------------------------------
811  //------------------------------------------------------------------------
813 
814  //------------------------------------------------------------------------
816  //------------------------------------------------------------------------
818  {
819  pOpenTime.tv_sec = 0; pOpenTime.tv_usec = 0;
820  pRBytes = 0;
821  pVRBytes = 0;
822  pWBytes = 0;
823  pVSegs = 0;
824  pRCount = 0;
825  pVRCount = 0;
826  pWCount = 0;
827  pCloseReason = Status();
828  }
829 
830  //------------------------------------------------------------------------
832  //------------------------------------------------------------------------
833  void MonitorClose( const XRootDStatus *status );
834 
835  //------------------------------------------------------------------------
841  //------------------------------------------------------------------------
843  Message *msg,
844  ResponseHandler *handler,
845  MessageSendParams &sendParams );
846 
847  //------------------------------------------------------------------------
849  //------------------------------------------------------------------------
850  static XRootDStatus WriteKernelBuffer( std::shared_ptr<FileStateHandler> &self,
851  uint64_t offset,
852  uint32_t length,
853  std::unique_ptr<XrdSys::KernelBuffer> kbuff,
854  ResponseHandler *handler,
855  uint16_t timeout );
856 
866  uint8_t *pFileHandle;
867  uint16_t pOpenMode;
868  uint16_t pOpenFlags;
870  std::set<Message*> pInTheFly;
871  uint64_t pSessionId;
878 
879  //------------------------------------------------------------------------
880  // Monitoring variables
881  //------------------------------------------------------------------------
882  timeval pOpenTime;
883  uint64_t pRBytes;
884  uint64_t pVRBytes;
885  uint64_t pWBytes;
886  uint64_t pVWBytes;
887  uint64_t pVSegs;
888  uint64_t pRCount;
889  uint64_t pVRCount;
890  uint64_t pWCount;
891  uint64_t pVWCount;
893 
894  //------------------------------------------------------------------------
895  // Responsible for file:// operations on the local filesystem
896  //------------------------------------------------------------------------
898 
899  //------------------------------------------------------------------------
900  // Responsible for Writing/Reading erasure-coded files
901  //------------------------------------------------------------------------
903  };
904 }
905 
906 #endif // __XRD_CL_FILE_STATE_HANDLER_HH__
unsigned char kXR_char
Definition: XPtypes.hh:65
#define XRDOUC_ENUM_OPERATORS(T)
Definition: XrdOucEnum.hh:22
Definition: XrdClAnyObject.hh:33
Binary blob representation.
Definition: XrdClBuffer.hh:34
An interface for file plug-ins.
Definition: XrdClPlugInInterface.hh:39
Handle the stateful operations.
Definition: XrdClFileStateHandler.hh:80
uint64_t pRBytes
Definition: XrdClFileStateHandler.hh:883
static XRootDStatus PgReadImpl(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, void *buffer, uint16_t flags, ResponseHandler *handler, uint16_t timeout=0)
URL * pDataServer
Definition: XrdClFileStateHandler.hh:862
static void OnStateResponse(std::shared_ptr< FileStateHandler > &self, XRootDStatus *status, Message *message, AnyObject *response, HostList *hostList)
Handle stateful response.
std::set< Message * > pInTheFly
Definition: XrdClFileStateHandler.hh:870
void AfterForkChild()
Called in the child process after the fork.
static XRootDStatus DelXAttr(std::shared_ptr< FileStateHandler > &self, const std::vector< std::string > &attrs, ResponseHandler *handler, uint16_t timeout=0)
URL * pStateRedirect
Definition: XrdClFileStateHandler.hh:864
static XRootDStatus SendClose(std::shared_ptr< FileStateHandler > &self, uint16_t timeout)
FileStateHandler(bool useVirtRedirector, FilePlugIn *&plugin)
static XRootDStatus Checkpoint(std::shared_ptr< FileStateHandler > &self, kXR_char code, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus Fcntl(std::shared_ptr< FileStateHandler > &self, const Buffer &arg, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus PgRead(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus Write(std::shared_ptr< FileStateHandler > &self, uint64_t offset, Buffer &&buffer, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus PgReadRetry(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, size_t pgnb, void *buffer, PgReadHandler *handler, uint16_t timeout=0)
void TimeOutRequests(time_t now)
Declare timeout on requests being recovered.
void ReWriteFileHandle(Message *msg)
Re-write file handle.
bool pDoRecoverRead
Definition: XrdClFileStateHandler.hh:872
void Tick(time_t now)
Tick.
bool IsReadOnly() const
Check if the file is open for read only.
bool pFollowRedirects
Definition: XrdClFileStateHandler.hh:874
void FailQueuedMessages(XRootDStatus status)
Fail queued messages.
std::list< RequestData > RequestList
Definition: XrdClFileStateHandler.hh:728
static Status XAttrOperationImpl(std::shared_ptr< FileStateHandler > &self, kXR_char subcode, kXR_char options, const std::vector< T > &attrs, ResponseHandler *handler, uint16_t timeout=0)
bool pIsChannelEncrypted
Definition: XrdClFileStateHandler.hh:876
static XRootDStatus Visa(std::shared_ptr< FileStateHandler > &self, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus IssueRequest(const URL &url, Message *msg, ResponseHandler *handler, MessageSendParams &sendParams)
uint64_t pVWBytes
Definition: XrdClFileStateHandler.hh:886
FileStateHandler(FilePlugIn *&plugin)
Constructor.
static XRootDStatus PgWriteImpl(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, std::vector< uint32_t > &cksums, kXR_char flags, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus VectorWrite(std::shared_ptr< FileStateHandler > &self, const ChunkList &chunks, ResponseHandler *handler, uint16_t timeout=0)
FilePlugIn *& pPlugin
Definition: XrdClFileStateHandler.hh:902
uint16_t pOpenFlags
Definition: XrdClFileStateHandler.hh:868
static XRootDStatus ReadV(std::shared_ptr< FileStateHandler > &self, uint64_t offset, struct iovec *iov, int iovcnt, ResponseHandler *handler, uint16_t timeout=0)
XrdSysMutex pMutex
Definition: XrdClFileStateHandler.hh:857
static XRootDStatus SetXAttr(std::shared_ptr< FileStateHandler > &self, const std::vector< xattr_t > &attrs, ResponseHandler *handler, uint16_t timeout=0)
URL * pLoadBalancer
Definition: XrdClFileStateHandler.hh:863
URL * pWrtRecoveryRedir
Definition: XrdClFileStateHandler.hh:865
uint64_t pVSegs
Definition: XrdClFileStateHandler.hh:887
StatInfo * pStatInfo
Definition: XrdClFileStateHandler.hh:860
FileStatus
State of the file.
Definition: XrdClFileStateHandler.hh:91
@ OpenInProgress
Opening is in progress.
Definition: XrdClFileStateHandler.hh:96
@ Closed
The file is closed.
Definition: XrdClFileStateHandler.hh:92
@ Opened
Opening has succeeded.
Definition: XrdClFileStateHandler.hh:93
@ Error
Opening has failed.
Definition: XrdClFileStateHandler.hh:94
@ Recovering
Recovering from an error.
Definition: XrdClFileStateHandler.hh:95
static XRootDStatus WriteKernelBuffer(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t length, std::unique_ptr< XrdSys::KernelBuffer > kbuff, ResponseHandler *handler, uint16_t timeout)
Send a write request with payload being stored in a kernel buffer.
static XRootDStatus VectorRead(std::shared_ptr< FileStateHandler > &self, const ChunkList &chunks, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
static Status SendOrQueue(std::shared_ptr< FileStateHandler > &self, const URL &url, Message *msg, ResponseHandler *handler, MessageSendParams &sendParams)
Send a message to a host or put it in the recovery queue.
void UnLock()
Unlock the internal lock.
Definition: XrdClFileStateHandler.hh:688
RequestList pToBeRecovered
Definition: XrdClFileStateHandler.hh:869
static Status RecoverMessage(std::shared_ptr< FileStateHandler > &self, RequestData rd, bool callbackOnFailure=true)
void ResetMonitoringVars()
Reset monitoring vars.
Definition: XrdClFileStateHandler.hh:817
XRootDStatus pCloseReason
Definition: XrdClFileStateHandler.hh:892
uint64_t pVWCount
Definition: XrdClFileStateHandler.hh:891
uint64_t pVRBytes
Definition: XrdClFileStateHandler.hh:884
uint64_t pSessionId
Definition: XrdClFileStateHandler.hh:871
bool SetProperty(const std::string &name, const std::string &value)
bool pAllowBundledClose
Definition: XrdClFileStateHandler.hh:877
void OnClose(const XRootDStatus *status)
Process the results of the closing operation.
static XRootDStatus PgWrite(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, std::vector< uint32_t > &cksums, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus TryOtherServer(std::shared_ptr< FileStateHandler > &self, uint16_t timeout)
Try other data server.
static XRootDStatus Open(std::shared_ptr< FileStateHandler > &self, const std::string &url, uint16_t flags, uint16_t mode, ResponseHandler *handler, uint16_t timeout=0)
uint16_t pOpenMode
Definition: XrdClFileStateHandler.hh:867
uint8_t * pFileHandle
Definition: XrdClFileStateHandler.hh:866
static XRootDStatus WriteV(std::shared_ptr< FileStateHandler > &self, uint64_t offset, const struct iovec *iov, int iovcnt, ResponseHandler *handler, uint16_t timeout=0)
void OnOpen(const XRootDStatus *status, const OpenInfo *openInfo, const HostList *hostList)
Process the results of the opening operation.
static XRootDStatus ChkptWrtV(std::shared_ptr< FileStateHandler > &self, uint64_t offset, const struct iovec *iov, int iovcnt, ResponseHandler *handler, uint16_t timeout=0)
uint64_t pRCount
Definition: XrdClFileStateHandler.hh:888
void MonitorClose(const XRootDStatus *status)
Dispatch monitoring information on close.
bool pDoRecoverWrite
Definition: XrdClFileStateHandler.hh:873
bool IsRecoverable(const XRootDStatus &stataus) const
Check if the stateful error is recoverable.
uint64_t pVRCount
Definition: XrdClFileStateHandler.hh:889
static XRootDStatus Write(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0)
uint64_t pWBytes
Definition: XrdClFileStateHandler.hh:885
static XRootDStatus ListXAttr(std::shared_ptr< FileStateHandler > &self, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus pStatus
Definition: XrdClFileStateHandler.hh:859
bool IsSecure() const
Check if the file is using an encrypted connection.
Definition: XrdClFileStateHandler.hh:658
static void OnStateRedirection(std::shared_ptr< FileStateHandler > &self, const std::string &redirectUrl, Message *message, ResponseHandler *userHandler, MessageSendParams &sendParams)
Handle stateful redirect.
static XRootDStatus Read(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, uint16_t timeout=0)
void FailMessage(RequestData rd, XRootDStatus status)
Fail a message.
~FileStateHandler()
Destructor.
bool GetProperty(const std::string &name, std::string &value) const
static XRootDStatus Sync(std::shared_ptr< FileStateHandler > &self, ResponseHandler *handler, uint16_t timeout=0)
LocalFileHandler * pLFileHandler
Definition: XrdClFileStateHandler.hh:897
static XRootDStatus Write(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, Optional< uint64_t > fdoff, int fd, ResponseHandler *handler, uint16_t timeout=0)
uint64_t pWCount
Definition: XrdClFileStateHandler.hh:890
static XRootDStatus ChkptWrt(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus GetXAttr(std::shared_ptr< FileStateHandler > &self, const std::vector< std::string > &attrs, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus ReOpenFileAtServer(std::shared_ptr< FileStateHandler > &self, const URL &url, uint16_t timeout)
Re-open the current file at a given server.
static XRootDStatus Truncate(std::shared_ptr< FileStateHandler > &self, uint64_t size, ResponseHandler *handler, uint16_t timeout=0)
static Status RunRecovery(std::shared_ptr< FileStateHandler > &self)
Run the recovery procedure if appropriate.
static void OnStateError(std::shared_ptr< FileStateHandler > &self, XRootDStatus *status, Message *message, ResponseHandler *userHandler, MessageSendParams &sendParams)
Handle an error while sending a stateful message.
FileStatus pFileState
Definition: XrdClFileStateHandler.hh:858
bool pUseVirtRedirector
Definition: XrdClFileStateHandler.hh:875
timeval pOpenTime
Definition: XrdClFileStateHandler.hh:882
static XRootDStatus Close(std::shared_ptr< FileStateHandler > &self, ResponseHandler *handler, uint16_t timeout=0)
bool IsOpen() const
Check if the file is open.
void ReSendQueuedMessages()
Re-send queued messages.
static XRootDStatus Stat(std::shared_ptr< FileStateHandler > &self, bool force, ResponseHandler *handler, uint16_t timeout=0)
static XRootDStatus PgWriteRetry(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, uint32_t digest, ResponseHandler *handler, uint16_t timeout=0)
void Lock()
Lock the internal lock.
Definition: XrdClFileStateHandler.hh:680
URL * pFileUrl
Definition: XrdClFileStateHandler.hh:861
Definition: XrdClLocalFileHandler.hh:33
The message representation used throughout the system.
Definition: XrdClMessage.hh:30
Information returned by file open operation.
Definition: XrdClXRootDResponses.hh:862
Definition: XrdClOptional.hh:44
Handle an async response.
Definition: XrdClXRootDResponses.hh:1126
Object stat info.
Definition: XrdClXRootDResponses.hh:400
URL representation.
Definition: XrdClURL.hh:31
Request status.
Definition: XrdClXRootDResponses.hh:219
Definition: XrdSysPthread.hh:165
Definition: XrdClAction.hh:34
std::vector< HostInfo > HostList
Definition: XrdClXRootDResponses.hh:1120
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:1055
static const int kXR_pgRetry
Definition: XProtocol.hh:503
Definition: XrdClFileStateHandler.hh:719
RequestData()
Definition: XrdClFileStateHandler.hh:720
Message * request
Definition: XrdClFileStateHandler.hh:724
RequestData(Message *r, ResponseHandler *h, const MessageSendParams &p)
Definition: XrdClFileStateHandler.hh:721
ResponseHandler * handler
Definition: XrdClFileStateHandler.hh:725
MessageSendParams params
Definition: XrdClFileStateHandler.hh:726
Definition: XrdClMessageUtils.hh:132
none object for initializing empty Optional
Definition: XrdClOptional.hh:35
PgRead flags.
Definition: XrdClFileStateHandler.hh:63
Flags
PgRead flags.
Definition: XrdClFileStateHandler.hh:68
@ Retry
Definition: XrdClFileStateHandler.hh:70
Procedure execution status.
Definition: XrdClStatus.hh:115
Definition: XrdOucIOVec.hh:65