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
37
38#include <list>
39#include <set>
40#include <vector>
41
42#include <sys/uio.h>
43#include <cstdint>
44
45namespace
46{
47 class PgReadHandler;
48 class PgReadRetryHandler;
49 class PgReadSubstitutionHandler;
50 class OpenHandler;
51}
52
53namespace XrdCl
54{
55 class Message;
56 class EcHandler;
57
58 //----------------------------------------------------------------------------
60 //----------------------------------------------------------------------------
62 {
63 //------------------------------------------------------------------------
65 //------------------------------------------------------------------------
66 enum Flags
67 {
68 None = 0, //< Nothing
69 Retry = XrdProto::kXR_pgRetry //< Retry reading currupted page
70
71 };
72 };
74
75 //----------------------------------------------------------------------------
77 //----------------------------------------------------------------------------
79 {
80 friend class ::PgReadHandler;
81 friend class ::PgReadRetryHandler;
82 friend class ::PgReadSubstitutionHandler;
83 friend class ::OpenHandler;
84
85 public:
86 //------------------------------------------------------------------------
88 //------------------------------------------------------------------------
90 {
96 CloseInProgress
97 };
98
99 //------------------------------------------------------------------------
101 //------------------------------------------------------------------------
103
104 //------------------------------------------------------------------------
109 //------------------------------------------------------------------------
110 FileStateHandler( bool useVirtRedirector, FilePlugIn *& plugin );
111
112 //------------------------------------------------------------------------
114 //------------------------------------------------------------------------
116
117 //------------------------------------------------------------------------
127 //------------------------------------------------------------------------
128 static XRootDStatus Open( std::shared_ptr<FileStateHandler> &self,
129 const std::string &url,
130 uint16_t flags,
131 uint16_t mode,
132 ResponseHandler *handler,
133 uint16_t timeout = 0 );
134
135 //------------------------------------------------------------------------
142 //------------------------------------------------------------------------
143 static XRootDStatus Close( std::shared_ptr<FileStateHandler> &self,
144 ResponseHandler *handler,
145 uint16_t timeout = 0 );
146
147 //------------------------------------------------------------------------
157 //------------------------------------------------------------------------
158 static XRootDStatus Stat( std::shared_ptr<FileStateHandler> &self,
159 bool force,
160 ResponseHandler *handler,
161 uint16_t timeout = 0 );
162
163
164 //------------------------------------------------------------------------
179 //------------------------------------------------------------------------
180 static XRootDStatus Read( std::shared_ptr<FileStateHandler> &self,
181 uint64_t offset,
182 uint32_t size,
183 void *buffer,
184 ResponseHandler *handler,
185 uint16_t timeout = 0 );
186
187 //------------------------------------------------------------------------
200 //------------------------------------------------------------------------
201 static XRootDStatus PgRead( std::shared_ptr<FileStateHandler> &self,
202 uint64_t offset,
203 uint32_t size,
204 void *buffer,
205 ResponseHandler *handler,
206 uint16_t timeout = 0 );
207
208 //------------------------------------------------------------------------
219 //------------------------------------------------------------------------
220 static XRootDStatus PgReadRetry( std::shared_ptr<FileStateHandler> &self,
221 uint64_t offset,
222 uint32_t size,
223 size_t pgnb,
224 void *buffer,
225 PgReadHandler *handler,
226 uint16_t timeout = 0 );
227
228 //------------------------------------------------------------------------
242 //------------------------------------------------------------------------
243 static XRootDStatus PgReadImpl( std::shared_ptr<FileStateHandler> &self,
244 uint64_t offset,
245 uint32_t size,
246 void *buffer,
247 uint16_t flags,
248 ResponseHandler *handler,
249 uint16_t timeout = 0 );
250
251 //------------------------------------------------------------------------
261 //------------------------------------------------------------------------
262 static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
263 uint64_t offset,
264 uint32_t size,
265 const void *buffer,
266 ResponseHandler *handler,
267 uint16_t timeout = 0 );
268
269 //------------------------------------------------------------------------
279 //------------------------------------------------------------------------
280 static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
281 uint64_t offset,
282 Buffer &&buffer,
283 ResponseHandler *handler,
284 uint16_t timeout = 0 );
285
286 //------------------------------------------------------------------------
299 //------------------------------------------------------------------------
300 static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
301 uint64_t offset,
302 uint32_t size,
303 Optional<uint64_t> fdoff,
304 int fd,
305 ResponseHandler *handler,
306 uint16_t timeout = 0 );
307
308 //------------------------------------------------------------------------
319 //------------------------------------------------------------------------
320 static XRootDStatus PgWrite( std::shared_ptr<FileStateHandler> &self,
321 uint64_t offset,
322 uint32_t size,
323 const void *buffer,
324 std::vector<uint32_t> &cksums,
325 ResponseHandler *handler,
326 uint16_t timeout = 0 );
327
328 //------------------------------------------------------------------------
338 //------------------------------------------------------------------------
339 static XRootDStatus PgWriteRetry( std::shared_ptr<FileStateHandler> &self,
340 uint64_t offset,
341 uint32_t size,
342 const void *buffer,
343 uint32_t digest,
344 ResponseHandler *handler,
345 uint16_t timeout = 0 );
346
347 //------------------------------------------------------------------------
359 //------------------------------------------------------------------------
360 static XRootDStatus PgWriteImpl( std::shared_ptr<FileStateHandler> &self,
361 uint64_t offset,
362 uint32_t size,
363 const void *buffer,
364 std::vector<uint32_t> &cksums,
365 kXR_char flags,
366 ResponseHandler *handler,
367 uint16_t timeout = 0 );
368
369 //------------------------------------------------------------------------
376 //------------------------------------------------------------------------
377 static XRootDStatus Sync( std::shared_ptr<FileStateHandler> &self,
378 ResponseHandler *handler,
379 uint16_t timeout = 0 );
380
381 //------------------------------------------------------------------------
389 //------------------------------------------------------------------------
390 static XRootDStatus Truncate( std::shared_ptr<FileStateHandler> &self,
391 uint64_t size,
392 ResponseHandler *handler,
393 uint16_t timeout = 0 );
394
395 //------------------------------------------------------------------------
404 //------------------------------------------------------------------------
405 static XRootDStatus VectorRead( std::shared_ptr<FileStateHandler> &self,
406 const ChunkList &chunks,
407 void *buffer,
408 ResponseHandler *handler,
409 uint16_t timeout = 0 );
410
411 //------------------------------------------------------------------------
419 //------------------------------------------------------------------------
420 static XRootDStatus VectorWrite( std::shared_ptr<FileStateHandler> &self,
421 const ChunkList &chunks,
422 ResponseHandler *handler,
423 uint16_t timeout = 0 );
424
425 //------------------------------------------------------------------------
435 //------------------------------------------------------------------------
436 static XRootDStatus WriteV( std::shared_ptr<FileStateHandler> &self,
437 uint64_t offset,
438 const struct iovec *iov,
439 int iovcnt,
440 ResponseHandler *handler,
441 uint16_t timeout = 0 );
442
443 //------------------------------------------------------------------------
453 //------------------------------------------------------------------------
454 static XRootDStatus ReadV( std::shared_ptr<FileStateHandler> &self,
455 uint64_t offset,
456 struct iovec *iov,
457 int iovcnt,
458 ResponseHandler *handler,
459 uint16_t timeout = 0 );
460
461 //------------------------------------------------------------------------
472 //------------------------------------------------------------------------
473 static XRootDStatus Fcntl( std::shared_ptr<FileStateHandler> &self,
474 const Buffer &arg,
475 ResponseHandler *handler,
476 uint16_t timeout = 0 );
477
478 //------------------------------------------------------------------------
487 //------------------------------------------------------------------------
488 static XRootDStatus Visa( std::shared_ptr<FileStateHandler> &self,
489 ResponseHandler *handler,
490 uint16_t timeout = 0 );
491
492 //------------------------------------------------------------------------
503 //------------------------------------------------------------------------
504 static XRootDStatus SetXAttr( std::shared_ptr<FileStateHandler> &self,
505 const std::vector<xattr_t> &attrs,
506 ResponseHandler *handler,
507 uint16_t timeout = 0 );
508
509 //------------------------------------------------------------------------
520 //------------------------------------------------------------------------
521 static XRootDStatus GetXAttr( std::shared_ptr<FileStateHandler> &self,
522 const std::vector<std::string> &attrs,
523 ResponseHandler *handler,
524 uint16_t timeout = 0 );
525
526 //------------------------------------------------------------------------
537 //------------------------------------------------------------------------
538 static XRootDStatus DelXAttr( std::shared_ptr<FileStateHandler> &self,
539 const std::vector<std::string> &attrs,
540 ResponseHandler *handler,
541 uint16_t timeout = 0 );
542
543 //------------------------------------------------------------------------
553 //------------------------------------------------------------------------
554 static XRootDStatus ListXAttr( std::shared_ptr<FileStateHandler> &self,
555 ResponseHandler *handler,
556 uint16_t timeout = 0 );
557
558 //------------------------------------------------------------------------
568 //------------------------------------------------------------------------
569 static XRootDStatus Checkpoint( std::shared_ptr<FileStateHandler> &self,
570 kXR_char code,
571 ResponseHandler *handler,
572 uint16_t timeout = 0 );
573
574 //------------------------------------------------------------------------
584 //------------------------------------------------------------------------
585 static XRootDStatus ChkptWrt( std::shared_ptr<FileStateHandler> &self,
586 uint64_t offset,
587 uint32_t size,
588 const void *buffer,
589 ResponseHandler *handler,
590 uint16_t timeout = 0 );
591
592 //------------------------------------------------------------------------
602 //------------------------------------------------------------------------
603 static XRootDStatus ChkptWrtV( std::shared_ptr<FileStateHandler> &self,
604 uint64_t offset,
605 const struct iovec *iov,
606 int iovcnt,
607 ResponseHandler *handler,
608 uint16_t timeout = 0 );
609
610 //------------------------------------------------------------------------
612 //------------------------------------------------------------------------
613 void OnOpen( const XRootDStatus *status,
614 const OpenInfo *openInfo,
615 const HostList *hostList );
616
617 //------------------------------------------------------------------------
619 //------------------------------------------------------------------------
620 void OnClose( const XRootDStatus *status );
621
622 //------------------------------------------------------------------------
624 //------------------------------------------------------------------------
625 static void OnStateError( std::shared_ptr<FileStateHandler> &self,
626 XRootDStatus *status,
627 Message *message,
628 ResponseHandler *userHandler,
629 MessageSendParams &sendParams );
630
631 //------------------------------------------------------------------------
633 //------------------------------------------------------------------------
634 static void OnStateRedirection( std::shared_ptr<FileStateHandler> &self,
635 const std::string &redirectUrl,
636 Message *message,
637 ResponseHandler *userHandler,
638 MessageSendParams &sendParams );
639
640 //------------------------------------------------------------------------
642 //------------------------------------------------------------------------
643 static void OnStateResponse( std::shared_ptr<FileStateHandler> &self,
644 XRootDStatus *status,
645 Message *message,
646 AnyObject *response,
647 HostList *hostList );
648
649 //------------------------------------------------------------------------
651 //------------------------------------------------------------------------
652 bool IsOpen() const;
653
654 //------------------------------------------------------------------------
656 //------------------------------------------------------------------------
657 inline bool IsSecure() const
658 {
659 return pIsChannelEncrypted;
660 }
661
662 //------------------------------------------------------------------------
666 //------------------------------------------------------------------------
667 bool SetProperty( const std::string &name, const std::string &value );
668
669 //------------------------------------------------------------------------
673 //------------------------------------------------------------------------
674 bool GetProperty( const std::string &name, std::string &value ) const;
675
676 //------------------------------------------------------------------------
678 //------------------------------------------------------------------------
679 void Lock()
680 {
681 pMutex.Lock();
682 }
683
684 //------------------------------------------------------------------------
686 //------------------------------------------------------------------------
687 void UnLock()
688 {
689 pMutex.UnLock();
690 }
691
692 //------------------------------------------------------------------------
694 //------------------------------------------------------------------------
695 void Tick( time_t now );
696
697 //------------------------------------------------------------------------
699 //------------------------------------------------------------------------
700 void TimeOutRequests( time_t now );
701
702 //------------------------------------------------------------------------
704 //------------------------------------------------------------------------
706
707 //------------------------------------------------------------------------
709 //------------------------------------------------------------------------
710 static XRootDStatus TryOtherServer( std::shared_ptr<FileStateHandler> &self,
711 uint16_t timeout );
712
713 private:
714 //------------------------------------------------------------------------
715 // Helper for queuing messages
716 //------------------------------------------------------------------------
718 {
719 RequestData(): request(0), handler(0) {}
721 const MessageSendParams &p ):
722 request(r), handler(h), params(p) {}
726 };
727 typedef std::list<RequestData> RequestList;
728
729 //------------------------------------------------------------------------
736 //------------------------------------------------------------------------
737 template<typename T>
738 static Status XAttrOperationImpl( std::shared_ptr<FileStateHandler> &self,
739 kXR_char subcode,
740 kXR_char options,
741 const std::vector<T> &attrs,
742 ResponseHandler *handler,
743 uint16_t timeout = 0 );
744
745 //------------------------------------------------------------------------
747 //------------------------------------------------------------------------
748 static Status SendOrQueue( std::shared_ptr<FileStateHandler> &self,
749 const URL &url,
750 Message *msg,
751 ResponseHandler *handler,
752 MessageSendParams &sendParams );
753
754 //------------------------------------------------------------------------
756 //------------------------------------------------------------------------
757 bool IsRecoverable( const XRootDStatus &stataus ) const;
758
759 //------------------------------------------------------------------------
765 //------------------------------------------------------------------------
766 static Status RecoverMessage( std::shared_ptr<FileStateHandler> &self,
767 RequestData rd,
768 bool callbackOnFailure = true );
769
770 //------------------------------------------------------------------------
772 //------------------------------------------------------------------------
773 static Status RunRecovery( std::shared_ptr<FileStateHandler> &self );
774
775 //------------------------------------------------------------------------
776 // Send a close and ignore the response
777 //------------------------------------------------------------------------
778 static XRootDStatus SendClose( std::shared_ptr<FileStateHandler> &self,
779 uint16_t timeout );
780
781 //------------------------------------------------------------------------
783 //------------------------------------------------------------------------
784 bool IsReadOnly() const;
785
786 //------------------------------------------------------------------------
788 //------------------------------------------------------------------------
789 static XRootDStatus ReOpenFileAtServer( std::shared_ptr<FileStateHandler> &self,
790 const URL &url,
791 uint16_t timeout );
792
793 //------------------------------------------------------------------------
795 //------------------------------------------------------------------------
797
798 //------------------------------------------------------------------------
800 //------------------------------------------------------------------------
802
803 //------------------------------------------------------------------------
805 //------------------------------------------------------------------------
807
808 //------------------------------------------------------------------------
810 //------------------------------------------------------------------------
812
813 //------------------------------------------------------------------------
815 //------------------------------------------------------------------------
817 {
818 pOpenTime.tv_sec = 0; pOpenTime.tv_usec = 0;
819 pRBytes = 0;
820 pVRBytes = 0;
821 pWBytes = 0;
822 pVSegs = 0;
823 pRCount = 0;
824 pVRCount = 0;
825 pWCount = 0;
826 pCloseReason = Status();
827 }
828
829 //------------------------------------------------------------------------
831 //------------------------------------------------------------------------
832 void MonitorClose( const XRootDStatus *status );
833
834 //------------------------------------------------------------------------
840 //------------------------------------------------------------------------
842 Message *msg,
843 ResponseHandler *handler,
844 MessageSendParams &sendParams );
845
846 //------------------------------------------------------------------------
848 //------------------------------------------------------------------------
849 static XRootDStatus WriteKernelBuffer( std::shared_ptr<FileStateHandler> &self,
850 uint64_t offset,
851 uint32_t length,
852 std::unique_ptr<XrdSys::KernelBuffer> kbuff,
853 ResponseHandler *handler,
854 uint16_t timeout );
855
865 uint8_t *pFileHandle;
866 uint16_t pOpenMode;
867 uint16_t pOpenFlags;
869 std::set<Message*> pInTheFly;
870 uint64_t pSessionId;
877
878 //------------------------------------------------------------------------
879 // Monitoring variables
880 //------------------------------------------------------------------------
881 timeval pOpenTime;
882 uint64_t pRBytes;
883 uint64_t pVRBytes;
884 uint64_t pWBytes;
885 uint64_t pVWBytes;
886 uint64_t pVSegs;
887 uint64_t pRCount;
888 uint64_t pVRCount;
889 uint64_t pWCount;
890 uint64_t pVWCount;
892
893 //------------------------------------------------------------------------
894 // Responsible for file:// operations on the local filesystem
895 //------------------------------------------------------------------------
897
898 //------------------------------------------------------------------------
899 // Responsible for Writing/Reading erasure-coded files
900 //------------------------------------------------------------------------
902 };
903}
904
905#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:79
uint64_t pRBytes
Definition: XrdClFileStateHandler.hh:882
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:861
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:869
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:863
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:871
void Tick(time_t now)
Tick.
bool IsReadOnly() const
Check if the file is open for read only.
bool pFollowRedirects
Definition: XrdClFileStateHandler.hh:873
void FailQueuedMessages(XRootDStatus status)
Fail queued messages.
std::list< RequestData > RequestList
Definition: XrdClFileStateHandler.hh:727
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:875
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:885
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:901
uint16_t pOpenFlags
Definition: XrdClFileStateHandler.hh:867
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:856
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:862
URL * pWrtRecoveryRedir
Definition: XrdClFileStateHandler.hh:864
uint64_t pVSegs
Definition: XrdClFileStateHandler.hh:886
StatInfo * pStatInfo
Definition: XrdClFileStateHandler.hh:859
FileStatus
State of the file.
Definition: XrdClFileStateHandler.hh:90
@ OpenInProgress
Opening is in progress.
Definition: XrdClFileStateHandler.hh:95
@ Closed
The file is closed.
Definition: XrdClFileStateHandler.hh:91
@ Opened
Opening has succeeded.
Definition: XrdClFileStateHandler.hh:92
@ Error
Opening has failed.
Definition: XrdClFileStateHandler.hh:93
@ Recovering
Recovering from an error.
Definition: XrdClFileStateHandler.hh:94
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:687
RequestList pToBeRecovered
Definition: XrdClFileStateHandler.hh:868
static Status RecoverMessage(std::shared_ptr< FileStateHandler > &self, RequestData rd, bool callbackOnFailure=true)
void ResetMonitoringVars()
Reset monitoring vars.
Definition: XrdClFileStateHandler.hh:816
XRootDStatus pCloseReason
Definition: XrdClFileStateHandler.hh:891
uint64_t pVWCount
Definition: XrdClFileStateHandler.hh:890
uint64_t pVRBytes
Definition: XrdClFileStateHandler.hh:883
uint64_t pSessionId
Definition: XrdClFileStateHandler.hh:870
bool SetProperty(const std::string &name, const std::string &value)
bool pAllowBundledClose
Definition: XrdClFileStateHandler.hh:876
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:866
uint8_t * pFileHandle
Definition: XrdClFileStateHandler.hh:865
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:887
void MonitorClose(const XRootDStatus *status)
Dispatch monitoring information on close.
bool pDoRecoverWrite
Definition: XrdClFileStateHandler.hh:872
bool IsRecoverable(const XRootDStatus &stataus) const
Check if the stateful error is recoverable.
uint64_t pVRCount
Definition: XrdClFileStateHandler.hh:888
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:884
static XRootDStatus ListXAttr(std::shared_ptr< FileStateHandler > &self, ResponseHandler *handler, uint16_t timeout=0)
XRootDStatus pStatus
Definition: XrdClFileStateHandler.hh:858
bool IsSecure() const
Check if the file is using an encrypted connection.
Definition: XrdClFileStateHandler.hh:657
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:896
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:889
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:857
bool pUseVirtRedirector
Definition: XrdClFileStateHandler.hh:874
timeval pOpenTime
Definition: XrdClFileStateHandler.hh:881
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:679
URL * pFileUrl
Definition: XrdClFileStateHandler.hh:860
Definition: XrdClLocalFileHandler.hh:33
The message representation used throughout the system.
Definition: XrdClMessage.hh:30
Information returned by file open operation.
Definition: XrdClXRootDResponses.hh:853
Definition: XrdClOptional.hh:44
Handle an async response.
Definition: XrdClXRootDResponses.hh:1117
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:1111
std::vector< ChunkInfo > ChunkList
List of chunks.
Definition: XrdClXRootDResponses.hh:1046
static const int kXR_pgRetry
Definition: XProtocol.hh:503
Definition: XrdClFileStateHandler.hh:718
RequestData()
Definition: XrdClFileStateHandler.hh:719
Message * request
Definition: XrdClFileStateHandler.hh:723
RequestData(Message *r, ResponseHandler *h, const MessageSendParams &p)
Definition: XrdClFileStateHandler.hh:720
ResponseHandler * handler
Definition: XrdClFileStateHandler.hh:724
MessageSendParams params
Definition: XrdClFileStateHandler.hh:725
Definition: XrdClMessageUtils.hh:132
none object for initializing empty Optional
Definition: XrdClOptional.hh:35
PgRead flags.
Definition: XrdClFileStateHandler.hh:62
Flags
PgRead flags.
Definition: XrdClFileStateHandler.hh:67
@ Retry
Definition: XrdClFileStateHandler.hh:69
Procedure execution status.
Definition: XrdClStatus.hh:114
Definition: XrdOucIOVec.hh:65