XRootD
Loading...
Searching...
No Matches
XrdClFileSystem.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_SYSTEM_HH__
26#define __XRD_CL_FILE_SYSTEM_HH__
27
28#include "XrdCl/XrdClURL.hh"
29#include "XrdCl/XrdClStatus.hh"
30#include "XrdOuc/XrdOucEnum.hh"
35#include <string>
36#include <vector>
37
38namespace XrdCl
39{
40 class PostMaster;
41 class FileSystemPlugIn;
42 class File;
43 struct MessageSendParams;
44
45 //----------------------------------------------------------------------------
47 //----------------------------------------------------------------------------
48 struct QueryCode
49 {
50 //--------------------------------------------------------------------------
52 //--------------------------------------------------------------------------
69 };
70
71 //----------------------------------------------------------------------------
73 //----------------------------------------------------------------------------
74 struct OpenFlags
75 {
76 //--------------------------------------------------------------------------
78 //--------------------------------------------------------------------------
116 };
118
119 //----------------------------------------------------------------------------
121 //----------------------------------------------------------------------------
122 struct Access
123 {
124 //--------------------------------------------------------------------------
126 //--------------------------------------------------------------------------
140 };
142
143 //----------------------------------------------------------------------------
145 //----------------------------------------------------------------------------
147 {
148 enum Flags
149 {
150 None = 0,
152 };
153 };
155
156 //----------------------------------------------------------------------------
158 //----------------------------------------------------------------------------
160 {
161 enum Flags
162 {
163 None = 0,
164 Stat = 1,
165 Locate = 2,
168 Merge = 8,
169 Chunked = 16,
170 Zip = 32,
171 Cksm = 64
172 };
173 };
175
176 //----------------------------------------------------------------------------
178 //----------------------------------------------------------------------------
199
200 //----------------------------------------------------------------------------
202 //----------------------------------------------------------------------------
203 struct FileSystemImpl;
204
205 //----------------------------------------------------------------------------
207 //----------------------------------------------------------------------------
209 {
210 friend class AssignLBHandler;
211 friend class ForkHandler;
212
213 public:
214 typedef std::vector<LocationInfo> LocationList;
215
216 //------------------------------------------------------------------------
221 //------------------------------------------------------------------------
222 FileSystem( const URL &url, bool enablePlugIns = true );
223
224 //------------------------------------------------------------------------
226 //------------------------------------------------------------------------
227 ~FileSystem();
228
229 //------------------------------------------------------------------------
240 //------------------------------------------------------------------------
241 XRootDStatus Locate( const std::string &path,
242 OpenFlags::Flags flags,
243 ResponseHandler *handler,
244 time_t timeout = 0 )
246
247 //------------------------------------------------------------------------
256 //------------------------------------------------------------------------
257 XRootDStatus Locate( const std::string &path,
258 OpenFlags::Flags flags,
259 LocationInfo *&response,
260 time_t timeout = 0 )
262
263 //------------------------------------------------------------------------
274 //------------------------------------------------------------------------
275 XRootDStatus DeepLocate( const std::string &path,
276 OpenFlags::Flags flags,
277 ResponseHandler *handler,
278 time_t timeout = 0 )
280
281 //------------------------------------------------------------------------
290 //------------------------------------------------------------------------
291 XRootDStatus DeepLocate( const std::string &path,
292 OpenFlags::Flags flags,
293 LocationInfo *&response,
294 time_t timeout = 0 )
296
297 //------------------------------------------------------------------------
306 //------------------------------------------------------------------------
307 XRootDStatus Mv( const std::string &source,
308 const std::string &dest,
309 ResponseHandler *handler,
310 time_t timeout = 0 )
312
313 //------------------------------------------------------------------------
321 //------------------------------------------------------------------------
322 XRootDStatus Mv( const std::string &source,
323 const std::string &dest,
324 time_t timeout = 0 )
326
327 //------------------------------------------------------------------------
338 //------------------------------------------------------------------------
339 XRootDStatus Query( QueryCode::Code queryCode,
340 const Buffer &arg,
341 ResponseHandler *handler,
342 time_t timeout = 0 )
344
345 //------------------------------------------------------------------------
354 //------------------------------------------------------------------------
355 XRootDStatus Query( QueryCode::Code queryCode,
356 const Buffer &arg,
357 Buffer *&response,
358 time_t timeout = 0 )
360
361 //------------------------------------------------------------------------
370 //------------------------------------------------------------------------
371 XRootDStatus Truncate( const std::string &path,
372 uint64_t size,
373 ResponseHandler *handler,
374 time_t timeout = 0 )
376
377 //------------------------------------------------------------------------
385 //------------------------------------------------------------------------
386 XRootDStatus Truncate( const std::string &path,
387 uint64_t size,
388 time_t timeout = 0 )
390
391 //------------------------------------------------------------------------
399 //------------------------------------------------------------------------
400 XRootDStatus Rm( const std::string &path,
401 ResponseHandler *handler,
402 time_t timeout = 0 )
404
405 //------------------------------------------------------------------------
412 //------------------------------------------------------------------------
413 XRootDStatus Rm( const std::string &path,
414 time_t timeout = 0 )
416
417 //------------------------------------------------------------------------
427 //------------------------------------------------------------------------
428 XRootDStatus MkDir( const std::string &path,
429 MkDirFlags::Flags flags,
430 Access::Mode mode,
431 ResponseHandler *handler,
432 time_t timeout = 0 )
434
435 //------------------------------------------------------------------------
444 //------------------------------------------------------------------------
445 XRootDStatus MkDir( const std::string &path,
446 MkDirFlags::Flags flags,
447 Access::Mode mode,
448 time_t timeout = 0 )
450
451 //------------------------------------------------------------------------
459 //------------------------------------------------------------------------
460 XRootDStatus RmDir( const std::string &path,
461 ResponseHandler *handler,
462 time_t timeout = 0 )
464
465 //------------------------------------------------------------------------
472 //------------------------------------------------------------------------
473 XRootDStatus RmDir( const std::string &path,
474 time_t timeout = 0 )
476
477 //------------------------------------------------------------------------
486 //------------------------------------------------------------------------
487 XRootDStatus ChMod( const std::string &path,
488 Access::Mode mode,
489 ResponseHandler *handler,
490 time_t timeout = 0 )
492
493 //------------------------------------------------------------------------
501 //------------------------------------------------------------------------
502 XRootDStatus ChMod( const std::string &path,
503 Access::Mode mode,
504 time_t timeout = 0 )
506
507 //------------------------------------------------------------------------
514 //------------------------------------------------------------------------
516 time_t timeout = 0 )
518
519 //------------------------------------------------------------------------
525 //------------------------------------------------------------------------
526 XRootDStatus Ping( time_t timeout = 0 ) XRD_WARN_UNUSED_RESULT;
527
528 //------------------------------------------------------------------------
538 //------------------------------------------------------------------------
539 XRootDStatus Stat( const std::string &path,
540 ResponseHandler *handler,
541 time_t timeout = 0 )
543
544 //------------------------------------------------------------------------
553 //------------------------------------------------------------------------
554 XRootDStatus Stat( const std::string &path,
555 StatInfo *&response,
556 time_t timeout = 0 )
558
559 //------------------------------------------------------------------------
569 //------------------------------------------------------------------------
570 XRootDStatus StatVFS( const std::string &path,
571 ResponseHandler *handler,
572 time_t timeout = 0 )
574
575 //------------------------------------------------------------------------
583 //------------------------------------------------------------------------
584 XRootDStatus StatVFS( const std::string &path,
585 StatInfoVFS *&response,
586 time_t timeout = 0 )
588
589 //------------------------------------------------------------------------
598 //------------------------------------------------------------------------
600 time_t timeout = 0 )
602
603 //------------------------------------------------------------------------
610 //------------------------------------------------------------------------
612 time_t timeout = 0 )
614
615 //------------------------------------------------------------------------
626 //------------------------------------------------------------------------
627 XRootDStatus DirList( const std::string &path,
628 DirListFlags::Flags flags,
629 ResponseHandler *handler,
630 time_t timeout = 0 )
632
633 //------------------------------------------------------------------------
642 //------------------------------------------------------------------------
643 XRootDStatus DirList( const std::string &path,
644 DirListFlags::Flags flags,
645 DirectoryList *&response,
646 time_t timeout = 0 )
648
649 //------------------------------------------------------------------------
659 //------------------------------------------------------------------------
660 XRootDStatus SendCache( const std::string &info,
661 ResponseHandler *handler,
662 time_t timeout = 0 )
664
665 //------------------------------------------------------------------------
673 //------------------------------------------------------------------------
674 XRootDStatus SendCache( const std::string &info,
675 Buffer *&response,
676 time_t timeout = 0 )
678
679 //------------------------------------------------------------------------
689 //------------------------------------------------------------------------
690 XRootDStatus SendInfo( const std::string &info,
691 ResponseHandler *handler,
692 time_t timeout = 0 )
694
695 //------------------------------------------------------------------------
703 //------------------------------------------------------------------------
704 XRootDStatus SendInfo( const std::string &info,
705 Buffer *&response,
706 time_t timeout = 0 )
708
709 //------------------------------------------------------------------------
721 //------------------------------------------------------------------------
722 XRootDStatus Prepare( const std::vector<std::string> &fileList,
723 PrepareFlags::Flags flags,
724 uint8_t priority,
725 ResponseHandler *handler,
726 time_t timeout = 0 )
728
729 //------------------------------------------------------------------------
739 //------------------------------------------------------------------------
740 XRootDStatus Prepare( const std::vector<std::string> &fileList,
741 PrepareFlags::Flags flags,
742 uint8_t priority,
743 Buffer *&response,
744 time_t timeout = 0 )
746
747 //------------------------------------------------------------------------
758 //------------------------------------------------------------------------
759 XRootDStatus SetXAttr( const std::string &path,
760 const std::vector<xattr_t> &attrs,
761 ResponseHandler *handler,
762 time_t timeout = 0 );
763
764 //------------------------------------------------------------------------
773 //------------------------------------------------------------------------
774 XRootDStatus SetXAttr( const std::string &path,
775 const std::vector<xattr_t> &attrs,
776 std::vector<XAttrStatus> &result,
777 time_t timeout = 0 );
778
779 //------------------------------------------------------------------------
790 //------------------------------------------------------------------------
791 XRootDStatus GetXAttr( const std::string &path,
792 const std::vector<std::string> &attrs,
793 ResponseHandler *handler,
794 time_t timeout = 0 );
795
796 //------------------------------------------------------------------------
805 //------------------------------------------------------------------------
806 XRootDStatus GetXAttr( const std::string &path,
807 const std::vector<std::string> &attrs,
808 std::vector<XAttr> &result,
809 time_t timeout = 0 );
810
811 //------------------------------------------------------------------------
822 //------------------------------------------------------------------------
823 XRootDStatus DelXAttr( const std::string &path,
824 const std::vector<std::string> &attrs,
825 ResponseHandler *handler,
826 time_t timeout = 0 );
827
828 //------------------------------------------------------------------------
837 //------------------------------------------------------------------------
838 XRootDStatus DelXAttr( const std::string &path,
839 const std::vector<std::string> &attrs,
840 std::vector<XAttrStatus> &result,
841 time_t timeout = 0 );
842
843 //------------------------------------------------------------------------
853 //------------------------------------------------------------------------
854 XRootDStatus ListXAttr( const std::string &path,
855 ResponseHandler *handler,
856 time_t timeout = 0 );
857
858 //------------------------------------------------------------------------
866 //------------------------------------------------------------------------
867 XRootDStatus ListXAttr( const std::string &path,
868 std::vector<XAttr> &result,
869 time_t timeout = 0 );
870
871 //------------------------------------------------------------------------
876 //------------------------------------------------------------------------
877 bool SetProperty( const std::string &name, const std::string &value );
878
879 //------------------------------------------------------------------------
883 //------------------------------------------------------------------------
884 bool GetProperty( const std::string &name, std::string &value ) const;
885
886 private:
887 FileSystem(const FileSystem &other);
888 FileSystem &operator = (const FileSystem &other);
889
890 //------------------------------------------------------------------------
891 // Lock the internal lock
892 //------------------------------------------------------------------------
893 void Lock();
894
895 //------------------------------------------------------------------------
896 // Unlock the internal lock
897 //------------------------------------------------------------------------
898 void UnLock();
899
900 //------------------------------------------------------------------------
907 //------------------------------------------------------------------------
908 XRootDStatus SendSet( const char *prefix,
909 const std::string &info,
910 ResponseHandler *handler,
911 time_t timeout = 0 )
913
914 //------------------------------------------------------------------------
922 //------------------------------------------------------------------------
923 template<typename T>
924 Status XAttrOperationImpl( kXR_char subcode,
925 kXR_char options,
926 const std::string &path,
927 const std::vector<T> &attrs,
928 ResponseHandler *handler,
929 time_t timeout = 0 );
930
931 FileSystemImpl *pImpl; //< pointer to implementation (TODO: once we can break ABI we can use a shared pointer here, and then we can drop the FileSystemData in source file)
932 FileSystemPlugIn *pPlugIn; //< file system plug-in
933 };
934}
935
936#endif // __XRD_CL_FILE_SYSTEM_HH__
@ kXR_open_wrto
Definition XProtocol.hh:499
@ kXR_compress
Definition XProtocol.hh:482
@ kXR_delete
Definition XProtocol.hh:483
@ kXR_prefname
Definition XProtocol.hh:491
@ kXR_nowait
Definition XProtocol.hh:497
@ kXR_open_read
Definition XProtocol.hh:486
@ kXR_open_updt
Definition XProtocol.hh:487
@ kXR_mkpath
Definition XProtocol.hh:490
@ kXR_seqio
Definition XProtocol.hh:498
@ kXR_replica
Definition XProtocol.hh:495
@ kXR_posc
Definition XProtocol.hh:496
@ kXR_refresh
Definition XProtocol.hh:489
@ kXR_new
Definition XProtocol.hh:485
@ kXR_force
Definition XProtocol.hh:484
@ kXR_4dirlist
Definition XProtocol.hh:494
@ kXR_wmode
Definition XProtocol.hh:625
@ kXR_evict
Definition XProtocol.hh:630
@ kXR_cancel
Definition XProtocol.hh:621
@ kXR_fresh
Definition XProtocol.hh:627
@ kXR_coloc
Definition XProtocol.hh:626
@ kXR_stage
Definition XProtocol.hh:624
@ kXR_dup
Definition XProtocol.hh:503
@ kXR_samefs
Definition XProtocol.hh:504
@ kXR_gw
Definition XProtocol.hh:474
@ kXR_ur
Definition XProtocol.hh:470
@ kXR_uw
Definition XProtocol.hh:471
@ kXR_gr
Definition XProtocol.hh:473
@ kXR_ow
Definition XProtocol.hh:477
@ kXR_gx
Definition XProtocol.hh:475
@ kXR_or
Definition XProtocol.hh:476
@ kXR_ox
Definition XProtocol.hh:478
@ kXR_ux
Definition XProtocol.hh:472
@ kXR_QPrep
Definition XProtocol.hh:650
@ kXR_Qopaqug
Definition XProtocol.hh:661
@ kXR_Qconfig
Definition XProtocol.hh:655
@ kXR_Qopaquf
Definition XProtocol.hh:660
@ kXR_QFSinfo
Definition XProtocol.hh:658
@ kXR_Qckscan
Definition XProtocol.hh:654
@ kXR_Qxattr
Definition XProtocol.hh:652
@ kXR_Qspace
Definition XProtocol.hh:653
@ kXR_Qvisa
Definition XProtocol.hh:656
@ kXR_QStats
Definition XProtocol.hh:649
@ kXR_Qcksum
Definition XProtocol.hh:651
@ kXR_QFinfo
Definition XProtocol.hh:657
@ kXR_Qopaque
Definition XProtocol.hh:659
unsigned char kXR_char
Definition XPtypes.hh:65
#define XRD_WARN_UNUSED_RESULT
#define XRDOUC_ENUM_OPERATORS(T)
Definition XrdOucEnum.hh:22
int Mode
Binary blob representation.
An interface for file plug-ins.
XRootDStatus Ping(ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Mv(const std::string &source, const std::string &dest, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
bool SetProperty(const std::string &name, const std::string &value)
XRootDStatus DirList(const std::string &path, DirListFlags::Flags flags, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Locate(const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus SendCache(const std::string &info, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Truncate(const std::string &path, uint64_t size, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus RmDir(const std::string &path, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus ListXAttr(const std::string &path, ResponseHandler *handler, time_t timeout=0)
XRootDStatus Stat(const std::string &path, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Rm(const std::string &path, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus StatVFS(const std::string &path, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
friend class AssignLBHandler
XRootDStatus GetXAttr(const std::string &path, const std::vector< std::string > &attrs, ResponseHandler *handler, time_t timeout=0)
XRootDStatus ChMod(const std::string &path, Access::Mode mode, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
FileSystem(const URL &url, bool enablePlugIns=true)
XRootDStatus Protocol(ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus DelXAttr(const std::string &path, const std::vector< std::string > &attrs, ResponseHandler *handler, time_t timeout=0)
XRootDStatus Prepare(const std::vector< std::string > &fileList, PrepareFlags::Flags flags, uint8_t priority, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus SendInfo(const std::string &info, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus MkDir(const std::string &path, MkDirFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus Query(QueryCode::Code queryCode, const Buffer &arg, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
XRootDStatus SetXAttr(const std::string &path, const std::vector< xattr_t > &attrs, ResponseHandler *handler, time_t timeout=0)
bool GetProperty(const std::string &name, std::string &value) const
XRootDStatus DeepLocate(const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, time_t timeout=0) XRD_WARN_UNUSED_RESULT
std::vector< LocationInfo > LocationList
Location list.
friend class ForkHandler
A file.
Definition XrdClFile.hh:52
Path location info.
A hub for dispatching and receiving messages.
Handle an async response.
Object stat info.
URL representation.
Definition XrdClURL.hh:31
LocateImpl< false > Locate
std::tuple< std::string, std::string > xattr_t
Extended attribute key - value pair.
@ OX
world executable/browsable
@ OW
world writeable
@ UR
owner readable
@ GR
group readable
@ UW
owner writable
@ GX
group executable/browsable
@ GW
group writable
@ UX
owner executable/browsable
@ OR
world readable
@ Stat
Stat each entry.
@ Merge
Merge duplicates.
@ Zip
List content of ZIP files.
@ None
Nothing special.
@ Recursive
Do a recursive listing.
@ Cksm
Get checksum for every entry.
@ Chunked
Serve chunked results for better performance.
Implementation holding the data members.
@ None
Nothing special.
@ MakePath
create the entire directory tree if it doesn't exist
Open flags, may be or'd when appropriate.
Flags
Open flags, may be or'd when appropriate.
@ Read
Open only for reading.
@ Samefs
Open file on the same filesystem as another.
@ Write
Open only for writing.
@ SeqIO
File will be read or written sequentially.
@ Update
Open for reading and writing.
@ Dup
Open file duplicating content from another.
@ Cancel
cancel staging request
@ Colocate
co-locate staged files, if possible
XRootD query request codes.
Code
XRootD query request codes.
@ OpaqueQ
Implementation dependent.
@ OpaqueFile
Implementation dependent.
@ XAttr
Query file extended attributes.
@ Opaque
Implementation dependent.
@ FInfo
Query op-dependant file information on FD.
@ Config
Query server configuration.
@ Stats
Query server stats.
@ ChecksumCancel
Query file checksum cancellation.
@ Checksum
Query file checksum.
@ Space
Query logical space stats.
@ Visa
Query file visa attributes.
@ Prepare
Query prepare status.
@ FSInfo
Query op-dependant file information on FS path.
Procedure execution status.
Extended attribute operation status.
Extended attributes with status.