XRootD
Loading...
Searching...
No Matches
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/time.h>
43#include <sys/uio.h>
44#include <cstdint>
45
46namespace
47{
48 class PgReadHandler;
49 class PgReadRetryHandler;
50 class PgReadSubstitutionHandler;
51 class OpenHandler;
52}
53
54namespace XrdCl
55{
56 class Message;
57 class EcHandler;
58 class FileStateHandler;
59
60 //----------------------------------------------------------------------------
62 //----------------------------------------------------------------------------
64 {
65 //------------------------------------------------------------------------
67 //------------------------------------------------------------------------
68 enum Flags
69 {
70 None = 0, //< Nothing
71 Retry = XrdProto::kXR_pgRetry //< Retry reading currupted page
72
73 };
74 };
76
77 //----------------------------------------------------------------------------
80 //----------------------------------------------------------------------------
82 {
83 public:
84 FileStateHandlerTemplate(std::shared_ptr<FileStateHandler> fhp) :
85 pTemplateFileWp(fhp) { }
86
88
89 std::weak_ptr<FileStateHandler> pTemplateFileWp;
90 };
91
92 //----------------------------------------------------------------------------
94 //----------------------------------------------------------------------------
96 {
97 friend class ::PgReadHandler;
98 friend class ::PgReadRetryHandler;
99 friend class ::PgReadSubstitutionHandler;
100 friend class ::OpenHandler;
101
102 public:
103 //------------------------------------------------------------------------
105 //------------------------------------------------------------------------
115
116 //------------------------------------------------------------------------
118 //------------------------------------------------------------------------
119 FileStateHandler( FilePlugIn *& plugin );
120
121 //------------------------------------------------------------------------
126 //------------------------------------------------------------------------
127 FileStateHandler( bool useVirtRedirector, FilePlugIn *& plugin );
128
129 //------------------------------------------------------------------------
131 //------------------------------------------------------------------------
133
134 //------------------------------------------------------------------------
144 //------------------------------------------------------------------------
145 static XRootDStatus Open( std::shared_ptr<FileStateHandler> &self,
146 const std::string &url,
147 OpenFlags::Flags flags,
148 uint16_t mode,
149 ResponseHandler *handler,
150 time_t timeout = 0 );
151
152 //------------------------------------------------------------------------
165 //------------------------------------------------------------------------
167 std::shared_ptr<FileStateHandler> &self,
169 const std::string &url,
170 OpenFlags::Flags flags,
171 uint16_t mode,
172 ResponseHandler *handler,
173 time_t timeout = 0 );
174
175 //------------------------------------------------------------------------
182 //------------------------------------------------------------------------
183 static XRootDStatus Close( std::shared_ptr<FileStateHandler> &self,
184 ResponseHandler *handler,
185 time_t timeout = 0 );
186
187 //------------------------------------------------------------------------
197 //------------------------------------------------------------------------
198 static XRootDStatus Stat( std::shared_ptr<FileStateHandler> &self,
199 bool force,
200 ResponseHandler *handler,
201 time_t timeout = 0 );
202
203 //------------------------------------------------------------------------
213 //------------------------------------------------------------------------
214 static XRootDStatus PreRead( std::shared_ptr<FileStateHandler> &self,
215 const TractList &tracts,
216 ResponseHandler *handler,
217 time_t timeout = 0 );
218
219 //------------------------------------------------------------------------
234 //------------------------------------------------------------------------
235 static XRootDStatus Read( std::shared_ptr<FileStateHandler> &self,
236 uint64_t offset,
237 uint32_t size,
238 void *buffer,
239 ResponseHandler *handler,
240 time_t timeout = 0 );
241
242 //------------------------------------------------------------------------
255 //------------------------------------------------------------------------
256 static XRootDStatus PgRead( std::shared_ptr<FileStateHandler> &self,
257 uint64_t offset,
258 uint32_t size,
259 void *buffer,
260 ResponseHandler *handler,
261 time_t timeout = 0 );
262
263 //------------------------------------------------------------------------
274 //------------------------------------------------------------------------
275 static XRootDStatus PgReadRetry( std::shared_ptr<FileStateHandler> &self,
276 uint64_t offset,
277 uint32_t size,
278 size_t pgnb,
279 void *buffer,
280 PgReadHandler *handler,
281 time_t timeout = 0 );
282
283 //------------------------------------------------------------------------
297 //------------------------------------------------------------------------
298 static XRootDStatus PgReadImpl( std::shared_ptr<FileStateHandler> &self,
299 uint64_t offset,
300 uint32_t size,
301 void *buffer,
302 uint16_t flags,
303 ResponseHandler *handler,
304 time_t timeout = 0 );
305
306 //------------------------------------------------------------------------
316 //------------------------------------------------------------------------
317 static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
318 uint64_t offset,
319 uint32_t size,
320 const void *buffer,
321 ResponseHandler *handler,
322 time_t timeout = 0 );
323
324 //------------------------------------------------------------------------
334 //------------------------------------------------------------------------
335 static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
336 uint64_t offset,
337 Buffer &&buffer,
338 ResponseHandler *handler,
339 time_t timeout = 0 );
340
341 //------------------------------------------------------------------------
354 //------------------------------------------------------------------------
355 static XRootDStatus Write( std::shared_ptr<FileStateHandler> &self,
356 uint64_t offset,
357 uint32_t size,
358 Optional<uint64_t> fdoff,
359 int fd,
360 ResponseHandler *handler,
361 time_t timeout = 0 );
362
363 //------------------------------------------------------------------------
374 //------------------------------------------------------------------------
375 static XRootDStatus PgWrite( std::shared_ptr<FileStateHandler> &self,
376 uint64_t offset,
377 uint32_t size,
378 const void *buffer,
379 std::vector<uint32_t> &cksums,
380 ResponseHandler *handler,
381 time_t timeout = 0 );
382
383 //------------------------------------------------------------------------
393 //------------------------------------------------------------------------
394 static XRootDStatus PgWriteRetry( std::shared_ptr<FileStateHandler> &self,
395 uint64_t offset,
396 uint32_t size,
397 const void *buffer,
398 uint32_t digest,
399 ResponseHandler *handler,
400 time_t timeout = 0 );
401
402 //------------------------------------------------------------------------
414 //------------------------------------------------------------------------
415 static XRootDStatus PgWriteImpl( std::shared_ptr<FileStateHandler> &self,
416 uint64_t offset,
417 uint32_t size,
418 const void *buffer,
419 std::vector<uint32_t> &cksums,
420 kXR_char flags,
421 ResponseHandler *handler,
422 time_t timeout = 0 );
423
424 //------------------------------------------------------------------------
431 //------------------------------------------------------------------------
432 static XRootDStatus Sync( std::shared_ptr<FileStateHandler> &self,
433 ResponseHandler *handler,
434 time_t timeout = 0 );
435
436 //------------------------------------------------------------------------
444 //------------------------------------------------------------------------
445 static XRootDStatus Truncate( std::shared_ptr<FileStateHandler> &self,
446 uint64_t size,
447 ResponseHandler *handler,
448 time_t timeout = 0 );
449
450 //------------------------------------------------------------------------
459 //------------------------------------------------------------------------
460 static XRootDStatus VectorRead( std::shared_ptr<FileStateHandler> &self,
461 const ChunkList &chunks,
462 void *buffer,
463 ResponseHandler *handler,
464 time_t timeout = 0 );
465
466 //------------------------------------------------------------------------
474 //------------------------------------------------------------------------
475 static XRootDStatus VectorWrite( std::shared_ptr<FileStateHandler> &self,
476 const ChunkList &chunks,
477 ResponseHandler *handler,
478 time_t timeout = 0 );
479
480 //------------------------------------------------------------------------
490 //------------------------------------------------------------------------
491 static XRootDStatus WriteV( std::shared_ptr<FileStateHandler> &self,
492 uint64_t offset,
493 const struct iovec *iov,
494 int iovcnt,
495 ResponseHandler *handler,
496 time_t timeout = 0 );
497
498 //------------------------------------------------------------------------
508 //------------------------------------------------------------------------
509 static XRootDStatus ReadV( std::shared_ptr<FileStateHandler> &self,
510 uint64_t offset,
511 struct iovec *iov,
512 int iovcnt,
513 ResponseHandler *handler,
514 time_t timeout = 0 );
515
516 //------------------------------------------------------------------------
528 //------------------------------------------------------------------------
529 static XRootDStatus Fcntl( std::shared_ptr<FileStateHandler> &self,
530 QueryCode::Code queryCode,
531 const Buffer &arg,
532 ResponseHandler *handler,
533 time_t timeout = 0 );
534
535 //------------------------------------------------------------------------
544 //------------------------------------------------------------------------
545 static XRootDStatus Visa( std::shared_ptr<FileStateHandler> &self,
546 ResponseHandler *handler,
547 time_t timeout = 0 );
548
549 //------------------------------------------------------------------------
560 //------------------------------------------------------------------------
561 static XRootDStatus SetXAttr( std::shared_ptr<FileStateHandler> &self,
562 const std::vector<xattr_t> &attrs,
563 ResponseHandler *handler,
564 time_t timeout = 0 );
565
566 //------------------------------------------------------------------------
577 //------------------------------------------------------------------------
578 static XRootDStatus GetXAttr( std::shared_ptr<FileStateHandler> &self,
579 const std::vector<std::string> &attrs,
580 ResponseHandler *handler,
581 time_t timeout = 0 );
582
583 //------------------------------------------------------------------------
594 //------------------------------------------------------------------------
595 static XRootDStatus DelXAttr( std::shared_ptr<FileStateHandler> &self,
596 const std::vector<std::string> &attrs,
597 ResponseHandler *handler,
598 time_t timeout = 0 );
599
600 //------------------------------------------------------------------------
610 //------------------------------------------------------------------------
611 static XRootDStatus ListXAttr( std::shared_ptr<FileStateHandler> &self,
612 ResponseHandler *handler,
613 time_t timeout = 0 );
614
615 //------------------------------------------------------------------------
625 //------------------------------------------------------------------------
626 static XRootDStatus Checkpoint( std::shared_ptr<FileStateHandler> &self,
627 kXR_char code,
628 ResponseHandler *handler,
629 time_t timeout = 0 );
630
631 //------------------------------------------------------------------------
641 //------------------------------------------------------------------------
642 static XRootDStatus ChkptWrt( std::shared_ptr<FileStateHandler> &self,
643 uint64_t offset,
644 uint32_t size,
645 const void *buffer,
646 ResponseHandler *handler,
647 time_t timeout = 0 );
648
649 //------------------------------------------------------------------------
659 //------------------------------------------------------------------------
660 static XRootDStatus ChkptWrtV( std::shared_ptr<FileStateHandler> &self,
661 uint64_t offset,
662 const struct iovec *iov,
663 int iovcnt,
664 ResponseHandler *handler,
665 time_t timeout = 0 );
666
667 //------------------------------------------------------------------------
675 //------------------------------------------------------------------------
676 static XRootDStatus Clone(std::shared_ptr<FileStateHandler> &self,
677 const CloneLocations &locs,
678 ResponseHandler *handler,
679 time_t timeout = 0 );
680
681 //------------------------------------------------------------------------
683 //------------------------------------------------------------------------
684 void OnOpen( const XRootDStatus *status,
685 const OpenInfo *openInfo,
686 const HostList *hostList );
687
688 //------------------------------------------------------------------------
690 //------------------------------------------------------------------------
691 void OnClose( const XRootDStatus *status );
692
693 //------------------------------------------------------------------------
695 //------------------------------------------------------------------------
696 static void OnStateError( std::shared_ptr<FileStateHandler> &self,
697 XRootDStatus *status,
698 Message *message,
699 ResponseHandler *userHandler,
700 MessageSendParams &sendParams );
701
702 //------------------------------------------------------------------------
704 //------------------------------------------------------------------------
705 static void OnStateRedirection( std::shared_ptr<FileStateHandler> &self,
706 const std::string &redirectUrl,
707 Message *message,
708 ResponseHandler *userHandler,
709 MessageSendParams &sendParams );
710
711 //------------------------------------------------------------------------
713 //------------------------------------------------------------------------
714 static void OnStateResponse( std::shared_ptr<FileStateHandler> &self,
715 XRootDStatus *status,
716 Message *message,
717 AnyObject *response,
718 HostList *hostList );
719
720 //------------------------------------------------------------------------
722 //------------------------------------------------------------------------
723 bool IsOpen() const;
724
725 //------------------------------------------------------------------------
727 //------------------------------------------------------------------------
728 inline bool IsSecure() const
729 {
730 return pIsChannelEncrypted;
731 }
732
733 //------------------------------------------------------------------------
737 //------------------------------------------------------------------------
738 bool SetProperty( const std::string &name, const std::string &value );
739
740 //------------------------------------------------------------------------
744 //------------------------------------------------------------------------
745 bool GetProperty( const std::string &name, std::string &value ) const;
746
747 //------------------------------------------------------------------------
749 //------------------------------------------------------------------------
750 void Lock()
751 {
752 pMutex.Lock();
753 }
754
755 //------------------------------------------------------------------------
757 //------------------------------------------------------------------------
758 void UnLock()
759 {
760 pMutex.UnLock();
761 }
762
763 //------------------------------------------------------------------------
765 //------------------------------------------------------------------------
766 void Tick( time_t now );
767
768 //------------------------------------------------------------------------
770 //------------------------------------------------------------------------
771 void TimeOutRequests( time_t now );
772
773 //------------------------------------------------------------------------
775 //------------------------------------------------------------------------
776 void AfterForkChild();
777
778 //------------------------------------------------------------------------
780 //------------------------------------------------------------------------
781 static XRootDStatus TryOtherServer( std::shared_ptr<FileStateHandler> &self,
782 time_t timeout );
783
784 //------------------------------------------------------------------------
787 //------------------------------------------------------------------------
788 static std::unique_ptr<ExportedFileTemplate> ExportTemplate(
789 std::shared_ptr<FileStateHandler> &self )
790 {
791 return std::make_unique<FileStateHandlerTemplate>(self);
792 }
793
794 //------------------------------------------------------------------------
796 //------------------------------------------------------------------------
797 bool NeedFileTempl() const
798 {
799 if( (pOpenFlags & OpenFlags::Dup) || (pOpenFlags & OpenFlags::Samefs) )
800 return true;
801 return false;
802 }
803
804 private:
805 //------------------------------------------------------------------------
806 // Helper for queuing messages
807 //------------------------------------------------------------------------
808 struct RequestData
809 {
810 RequestData(): request(0), handler(0) {}
811 RequestData( Message *r, ResponseHandler *h,
812 const MessageSendParams &p ):
813 request(r), handler(h), params(p) {}
814 Message *request;
815 ResponseHandler *handler;
816 MessageSendParams params;
817 };
818 typedef std::list<RequestData> RequestList;
819
820 //------------------------------------------------------------------------
827 //------------------------------------------------------------------------
828 template<typename T>
829 static Status XAttrOperationImpl( std::shared_ptr<FileStateHandler> &self,
830 kXR_char subcode,
831 kXR_char options,
832 const std::vector<T> &attrs,
833 ResponseHandler *handler,
834 time_t timeout = 0 );
835
836 //------------------------------------------------------------------------
838 //------------------------------------------------------------------------
839 static Status SendOrQueue( std::shared_ptr<FileStateHandler> &self,
840 const URL &url,
841 Message *msg,
842 ResponseHandler *handler,
843 MessageSendParams &sendParams );
844
845 //------------------------------------------------------------------------
847 //------------------------------------------------------------------------
848 bool IsRecoverable( const XRootDStatus &stataus ) const;
849
850 //------------------------------------------------------------------------
856 //------------------------------------------------------------------------
857 static Status RecoverMessage( std::shared_ptr<FileStateHandler> &self,
858 RequestData rd,
859 bool callbackOnFailure = true );
860
861 //------------------------------------------------------------------------
863 //------------------------------------------------------------------------
864 static Status RunRecovery( std::shared_ptr<FileStateHandler> &self );
865
866 //------------------------------------------------------------------------
867 // Send a close and ignore the response
868 //------------------------------------------------------------------------
869 static XRootDStatus SendClose( std::shared_ptr<FileStateHandler> &self,
870 time_t timeout );
871
872 //------------------------------------------------------------------------
874 //------------------------------------------------------------------------
875 bool IsReadOnly() const;
876
877 //------------------------------------------------------------------------
879 //------------------------------------------------------------------------
880 static XRootDStatus ReOpenFileAtServer( std::shared_ptr<FileStateHandler> &self,
881 const URL &url,
882 time_t timeout );
883
884 //------------------------------------------------------------------------
886 //------------------------------------------------------------------------
887 void FailMessage( RequestData rd, XRootDStatus status );
888
889 //------------------------------------------------------------------------
891 //------------------------------------------------------------------------
892 void FailQueuedMessages( XRootDStatus status );
893
894 //------------------------------------------------------------------------
896 //------------------------------------------------------------------------
897 static XRootDStatus FillFhTempl( std::shared_ptr<FileStateHandler> &self,
898 const URL &url,
899 Message *msg,
900 URL &sendUrl );
901
902 //------------------------------------------------------------------------
904 //------------------------------------------------------------------------
905 static XRootDStatus OpenImpl( std::shared_ptr<FileStateHandler> &self,
906 const std::string &url,
907 OpenFlags::Flags flags,
908 uint16_t mode,
909 ResponseHandler *handler,
910 time_t timeout = 0 );
911
912 //------------------------------------------------------------------------
914 //------------------------------------------------------------------------
915 void ReSendQueuedMessages();
916
917 //------------------------------------------------------------------------
919 //------------------------------------------------------------------------
920 void ReWriteFileHandle( Message *msg );
921
922 //------------------------------------------------------------------------
924 //------------------------------------------------------------------------
925 void ResetMonitoringVars()
926 {
927 pOpenTime.tv_sec = 0; pOpenTime.tv_usec = 0;
928 pRBytes = 0;
929 pVRBytes = 0;
930 pWBytes = 0;
931 pVSegs = 0;
932 pRCount = 0;
933 pVRCount = 0;
934 pWCount = 0;
935 pCloseReason = Status();
936 }
937
938 //------------------------------------------------------------------------
940 //------------------------------------------------------------------------
941 void MonitorClose( const XRootDStatus *status );
942
943 //------------------------------------------------------------------------
949 //------------------------------------------------------------------------
950 XRootDStatus IssueRequest( const URL &url,
951 Message *msg,
952 ResponseHandler *handler,
953 MessageSendParams &sendParams );
954
955 //------------------------------------------------------------------------
957 //------------------------------------------------------------------------
958 static XRootDStatus WriteKernelBuffer( std::shared_ptr<FileStateHandler> &self,
959 uint64_t offset,
960 uint32_t length,
961 std::unique_ptr<XrdSys::KernelBuffer> kbuff,
962 ResponseHandler *handler,
963 time_t timeout );
964
965 mutable XrdSysMutex pMutex;
966 FileStatus pFileState;
967 XRootDStatus pStatus;
968 StatInfo *pStatInfo;
969 URL *pFileUrl;
970 URL *pDataServer;
971 URL *pLoadBalancer;
972 URL *pStateRedirect;
973 URL *pWrtRecoveryRedir;
974 uint8_t *pFileHandle;
975 uint16_t pOpenMode;
976 OpenFlags::Flags pOpenFlags;
977 RequestList pToBeRecovered;
978 std::set<Message*> pInTheFly;
979 uint64_t pSessionId;
980 bool pDoRecoverRead;
981 bool pDoRecoverWrite;
982 bool pFollowRedirects;
983 bool pUseVirtRedirector;
984 bool pIsChannelEncrypted;
985 bool pAllowBundledClose;
986
987 //------------------------------------------------------------------------
988 // Monitoring variables
989 //------------------------------------------------------------------------
990 timeval pOpenTime;
991 uint64_t pRBytes;
992 uint64_t pVRBytes;
993 uint64_t pWBytes;
994 uint64_t pVWBytes;
995 uint64_t pVSegs;
996 uint64_t pRCount;
997 uint64_t pVRCount;
998 uint64_t pWCount;
999 uint64_t pVWCount;
1000 XRootDStatus pCloseReason;
1001
1002 //------------------------------------------------------------------------
1003 // Responsible for file:// operations on the local filesystem
1004 //------------------------------------------------------------------------
1005 LocalFileHandler *pLFileHandler;
1006
1007 //------------------------------------------------------------------------
1008 // Responsible for Writing/Reading erasure-coded files
1009 //------------------------------------------------------------------------
1010 FilePlugIn *&pPlugin;
1011
1012 //------------------------------------------------------------------------
1013 // Used to select use of file template, with optional duplication on open
1014 //------------------------------------------------------------------------
1015 std::weak_ptr<FileStateHandler> pTemplateFileWp;
1016 };
1017}
1018
1019#endif // __XRD_CL_FILE_STATE_HANDLER_HH__
unsigned char kXR_char
Definition XPtypes.hh:65
struct stat Stat
Definition XrdCks.cc:49
#define XRDOUC_ENUM_OPERATORS(T)
Definition XrdOucEnum.hh:22
Binary blob representation.
An interface for file plug-ins.
FileStateHandlerTemplate(std::shared_ptr< FileStateHandler > fhp)
std::weak_ptr< FileStateHandler > pTemplateFileWp
Handle the stateful operations.
static XRootDStatus PgReadRetry(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, size_t pgnb, void *buffer, PgReadHandler *handler, time_t timeout=0)
static XRootDStatus TryOtherServer(std::shared_ptr< FileStateHandler > &self, time_t timeout)
Try other data server.
static XRootDStatus Read(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus SetXAttr(std::shared_ptr< FileStateHandler > &self, const std::vector< xattr_t > &attrs, ResponseHandler *handler, time_t timeout=0)
void AfterForkChild()
Called in the child process after the fork.
static XRootDStatus PgReadImpl(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, void *buffer, uint16_t flags, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus Clone(std::shared_ptr< FileStateHandler > &self, const CloneLocations &locs, ResponseHandler *handler, time_t timeout=0)
static void OnStateRedirection(std::shared_ptr< FileStateHandler > &self, const std::string &redirectUrl, Message *message, ResponseHandler *userHandler, MessageSendParams &sendParams)
Handle stateful redirect.
void TimeOutRequests(time_t now)
Declare timeout on requests being recovered.
static XRootDStatus ListXAttr(std::shared_ptr< FileStateHandler > &self, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus Truncate(std::shared_ptr< FileStateHandler > &self, uint64_t size, ResponseHandler *handler, time_t timeout=0)
bool NeedFileTempl() const
Checks if we need to set a file template.
static XRootDStatus Checkpoint(std::shared_ptr< FileStateHandler > &self, kXR_char code, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus PgWrite(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, std::vector< uint32_t > &cksums, ResponseHandler *handler, time_t timeout=0)
static void OnStateError(std::shared_ptr< FileStateHandler > &self, XRootDStatus *status, Message *message, ResponseHandler *userHandler, MessageSendParams &sendParams)
Handle an error while sending a stateful message.
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, time_t timeout=0)
static std::unique_ptr< ExportedFileTemplate > ExportTemplate(std::shared_ptr< FileStateHandler > &self)
static XRootDStatus ChkptWrt(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus Write(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, time_t timeout=0)
@ OpenInProgress
Opening is in progress.
@ CloseInProgress
Closing operation is in progress.
@ Opened
Opening has succeeded.
@ Recovering
Recovering from an error.
void UnLock()
Unlock the internal lock.
static XRootDStatus PgWriteRetry(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, const void *buffer, uint32_t digest, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus Close(std::shared_ptr< FileStateHandler > &self, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus ReadV(std::shared_ptr< FileStateHandler > &self, uint64_t offset, struct iovec *iov, int iovcnt, ResponseHandler *handler, time_t timeout=0)
bool SetProperty(const std::string &name, const std::string &value)
static void OnStateResponse(std::shared_ptr< FileStateHandler > &self, XRootDStatus *status, Message *message, AnyObject *response, HostList *hostList)
Handle stateful response.
void OnClose(const XRootDStatus *status)
Process the results of the closing operation.
static XRootDStatus DelXAttr(std::shared_ptr< FileStateHandler > &self, const std::vector< std::string > &attrs, ResponseHandler *handler, time_t timeout=0)
void OnOpen(const XRootDStatus *status, const OpenInfo *openInfo, const HostList *hostList)
Process the results of the opening operation.
static XRootDStatus Open(std::shared_ptr< FileStateHandler > &self, const std::string &url, OpenFlags::Flags flags, uint16_t mode, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus PgRead(std::shared_ptr< FileStateHandler > &self, uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus OpenUsingTemplate(std::shared_ptr< FileStateHandler > &self, ExportedFileTemplate *templ, const std::string &url, OpenFlags::Flags flags, uint16_t mode, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus Sync(std::shared_ptr< FileStateHandler > &self, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus PreRead(std::shared_ptr< FileStateHandler > &self, const TractList &tracts, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus ChkptWrtV(std::shared_ptr< FileStateHandler > &self, uint64_t offset, const struct iovec *iov, int iovcnt, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus GetXAttr(std::shared_ptr< FileStateHandler > &self, const std::vector< std::string > &attrs, ResponseHandler *handler, time_t timeout=0)
bool IsSecure() const
Check if the file is using an encrypted connection.
static XRootDStatus WriteV(std::shared_ptr< FileStateHandler > &self, uint64_t offset, const struct iovec *iov, int iovcnt, ResponseHandler *handler, time_t timeout=0)
bool GetProperty(const std::string &name, std::string &value) const
static XRootDStatus VectorRead(std::shared_ptr< FileStateHandler > &self, const ChunkList &chunks, void *buffer, ResponseHandler *handler, time_t timeout=0)
static XRootDStatus VectorWrite(std::shared_ptr< FileStateHandler > &self, const ChunkList &chunks, ResponseHandler *handler, time_t timeout=0)
bool IsOpen() const
Check if the file is open.
void Lock()
Lock the internal lock.
The message representation used throughout the system.
Information returned by file open operation.
Handle an async response.
std::vector< HostInfo > HostList
FcntlImpl< false > Fcntl
VisaImpl< false > Visa
std::vector< TractInfo > TractList
List of Tracts.
std::vector< ChunkInfo > ChunkList
List of chunks.
static const int kXR_pgRetry
Definition XProtocol.hh:537
Flags
Open flags, may be or'd when appropriate.
@ Samefs
Open file on the same filesystem as another.
@ Dup
Open file duplicating content from another.
Code
XRootD query request codes.