XRootD
XrdClPlugInInterface.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 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_PLUGIN_INTERFACE__
26 #define __XRD_CL_PLUGIN_INTERFACE__
27 
28 #include "XrdCl/XrdClFile.hh"
29 #include "XrdCl/XrdClFileSystem.hh"
30 #include "XrdCl/XrdClOptional.hh"
31 
32 namespace XrdCl
33 {
34 
35  //----------------------------------------------------------------------------
37  //----------------------------------------------------------------------------
38  class FilePlugIn
39  {
40  public:
41  //------------------------------------------------------------------------
43  //------------------------------------------------------------------------
44  virtual ~FilePlugIn() {}
45  //------------------------------------------------------------------------
47  //------------------------------------------------------------------------
48  virtual XRootDStatus Open( const std::string &url,
49  OpenFlags::Flags flags,
50  Access::Mode mode,
51  ResponseHandler *handler,
52  time_t timeout )
53  {
54  (void)url; (void)flags; (void)mode; (void)handler; (void)timeout;
56  }
57 
58  //------------------------------------------------------------------------
60  //------------------------------------------------------------------------
62  const std::string &url,
63  OpenFlags::Flags flags,
64  Access::Mode mode,
65  ResponseHandler *handler,
66  time_t timeout )
67  {
68  (void)templ; (void)url; (void)flags; (void)mode; (void)handler; (void)timeout;
70  }
71 
72  //------------------------------------------------------------------------
74  //------------------------------------------------------------------------
75  virtual XRootDStatus Close( ResponseHandler *handler,
76  time_t timeout )
77  {
78  (void)handler; (void)timeout;
80  }
81 
82  //------------------------------------------------------------------------
84  //------------------------------------------------------------------------
85  virtual XRootDStatus Stat( bool force,
86  ResponseHandler *handler,
87  time_t timeout )
88  {
89  (void)force; (void)handler; (void)timeout;
91  }
92 
93  //------------------------------------------------------------------------
95  //------------------------------------------------------------------------
96  virtual XRootDStatus Read( uint64_t offset,
97  uint32_t size,
98  void *buffer,
99  ResponseHandler *handler,
100  time_t timeout )
101  {
102  (void)offset; (void)size; (void)buffer; (void)handler; (void)timeout;
104  }
105 
106  //------------------------------------------------------------------------
108  //------------------------------------------------------------------------
109  virtual XRootDStatus Read( uint64_t offset,
110  uint32_t size,
111  Optional<uint64_t> fdoff,
112  int fd,
113  ResponseHandler *handler,
114  time_t timeout = 0 )
115  {
116  (void)offset; (void)size; (void)fdoff; (void)fd, (void)handler; (void)timeout;
118  }
119 
120  //------------------------------------------------------------------------
122  //------------------------------------------------------------------------
123  virtual XRootDStatus PgRead( uint64_t offset,
124  uint32_t size,
125  void *buffer,
126  ResponseHandler *handler,
127  time_t timeout )
128  {
129  (void)offset; (void)size; (void)buffer; (void)handler; (void)timeout;
131  }
132 
133  //------------------------------------------------------------------------
135  //------------------------------------------------------------------------
136  virtual XRootDStatus Write( uint64_t offset,
137  uint32_t size,
138  const void *buffer,
139  ResponseHandler *handler,
140  time_t timeout )
141  {
142  (void)offset; (void)size; (void)buffer; (void)handler; (void)timeout;
144  }
145 
146  //------------------------------------------------------------------------
148  //------------------------------------------------------------------------
149  virtual XRootDStatus Write( uint64_t offset,
150  Buffer &&buffer,
151  ResponseHandler *handler,
152  time_t timeout = 0 )
153  {
154  (void)offset; (void)buffer; (void)handler; (void)timeout;
156  }
157 
158  //------------------------------------------------------------------------
160  //------------------------------------------------------------------------
161  virtual XRootDStatus Write( uint64_t offset,
162  uint32_t size,
163  Optional<uint64_t> fdoff,
164  int fd,
165  ResponseHandler *handler,
166  time_t timeout = 0 )
167  {
168  (void)offset; (void)size; (void)fdoff; (void)fd, (void)handler; (void)timeout;
170  }
171 
172  //------------------------------------------------------------------------
174  //------------------------------------------------------------------------
175  virtual XRootDStatus PgWrite( uint64_t offset,
176  uint32_t nbpgs,
177  const void *buffer,
178  std::vector<uint32_t> &cksums,
179  ResponseHandler *handler,
180  time_t timeout )
181  {
182  (void)offset; (void)nbpgs; (void)buffer; (void)cksums, (void)handler; (void)timeout;
184  }
185 
186  //------------------------------------------------------------------------
188  //------------------------------------------------------------------------
189  virtual XRootDStatus Sync( ResponseHandler *handler,
190  time_t timeout )
191  {
192  (void)handler; (void)timeout;
194  }
195 
196  //------------------------------------------------------------------------
198  //------------------------------------------------------------------------
199  virtual XRootDStatus Truncate( uint64_t size,
200  ResponseHandler *handler,
201  time_t timeout )
202  {
203  (void)size; (void)handler; (void)timeout;
205  }
206 
207  //------------------------------------------------------------------------
209  //------------------------------------------------------------------------
210  virtual XRootDStatus PreRead( const TractList &tracts,
211  ResponseHandler *handler,
212  time_t timeout )
213  {
214  (void)tracts; (void)handler; (void)timeout;
215  return XRootDStatus();
216  }
217 
218 
219  //------------------------------------------------------------------------
221  //------------------------------------------------------------------------
222  virtual XRootDStatus VectorRead( const ChunkList &chunks,
223  void *buffer,
224  ResponseHandler *handler,
225  time_t timeout )
226  {
227  (void)chunks; (void)buffer; (void)handler; (void)timeout;
229  }
230 
231  //------------------------------------------------------------------------
233  //------------------------------------------------------------------------
234  virtual XRootDStatus VectorWrite( const ChunkList &chunks,
235  ResponseHandler *handler,
236  time_t timeout = 0 )
237  {
238  (void)chunks; (void)handler; (void)timeout;
240  }
241 
242 
243  //------------------------------------------------------------------------
245  //------------------------------------------------------------------------
246  virtual XRootDStatus WriteV( uint64_t offset,
247  const struct iovec *iov,
248  int iovcnt,
249  ResponseHandler *handler,
250  time_t timeout = 0 )
251  {
252  (void)offset; (void)iov; (void)iovcnt; (void)handler; (void)timeout;
254  }
255 
256  //------------------------------------------------------------------------
258  //------------------------------------------------------------------------
259  virtual XRootDStatus Fcntl( const Buffer &arg,
260  ResponseHandler *handler,
261  time_t timeout )
262  {
263  (void)arg; (void)handler; (void)timeout;
265  }
266 
267  //------------------------------------------------------------------------
269  //------------------------------------------------------------------------
270  virtual XRootDStatus Fcntl( QueryCode::Code queryCode,
271  const Buffer &arg,
272  ResponseHandler *handler,
273  time_t timeout )
274  {
275  (void)arg; (void)handler; (void)timeout;
277  }
278 
279  //------------------------------------------------------------------------
281  //------------------------------------------------------------------------
282  virtual XRootDStatus Visa( ResponseHandler *handler,
283  time_t timeout )
284  {
285  (void)handler; (void)timeout;
287  }
288 
289  //------------------------------------------------------------------------
291  //------------------------------------------------------------------------
292  virtual bool IsOpen() const
293  {
294  return false;
295  }
296 
297  //------------------------------------------------------------------------
299  //------------------------------------------------------------------------
300  virtual bool SetProperty( const std::string &name,
301  const std::string &value )
302  {
303  (void)name; (void)value;
304  return false;
305  }
306 
307  //------------------------------------------------------------------------
309  //------------------------------------------------------------------------
310  virtual bool GetProperty( const std::string &name,
311  std::string &value ) const
312  {
313  (void)name; (void)value;
314  return false;
315  }
316 
317  //------------------------------------------------------------------------
326  //------------------------------------------------------------------------
327  virtual std::unique_ptr<ExportedFileTemplate> ExportTemplate() const
328  {
329  return {};
330  }
331 
332  //------------------------------------------------------------------------
334  //------------------------------------------------------------------------
335  virtual XRootDStatus Clone( const CloneLocations &locs, ResponseHandler *handler, time_t timeout )
336  {
337  (void)locs; (void)handler, (void)timeout;
339  }
340  };
341 
342  //----------------------------------------------------------------------------
344  //----------------------------------------------------------------------------
346  {
347  public:
348  //------------------------------------------------------------------------
350  //------------------------------------------------------------------------
351  virtual ~FileSystemPlugIn() {}
352 
353  //------------------------------------------------------------------------
355  //------------------------------------------------------------------------
356  virtual XRootDStatus Locate( const std::string &path,
357  OpenFlags::Flags flags,
358  ResponseHandler *handler,
359  time_t timeout )
360  {
361  (void)path; (void)flags; (void)handler; (void)timeout;
363  }
364 
365  //------------------------------------------------------------------------
367  //------------------------------------------------------------------------
368  virtual XRootDStatus DeepLocate( const std::string &path,
369  OpenFlags::Flags flags,
370  ResponseHandler *handler,
371  time_t timeout )
372  {
373  (void)path; (void)flags; (void)handler; (void)timeout;
375  }
376 
377  //------------------------------------------------------------------------
379  //------------------------------------------------------------------------
380  virtual XRootDStatus Mv( const std::string &source,
381  const std::string &dest,
382  ResponseHandler *handler,
383  time_t timeout )
384  {
385  (void)source; (void)dest; (void)handler; (void)timeout;
387  }
388 
389  //------------------------------------------------------------------------
391  //------------------------------------------------------------------------
392  virtual XRootDStatus Query( QueryCode::Code queryCode,
393  const Buffer &arg,
394  ResponseHandler *handler,
395  time_t timeout )
396  {
397  (void)queryCode; (void)arg; (void)handler; (void)timeout;
399  }
400 
401  //------------------------------------------------------------------------
403  //------------------------------------------------------------------------
404  virtual XRootDStatus Truncate( const std::string &path,
405  uint64_t size,
406  ResponseHandler *handler,
407  time_t timeout )
408  {
409  (void)path; (void)size; (void)handler; (void)timeout;
411  }
412 
413  //------------------------------------------------------------------------
415  //------------------------------------------------------------------------
416  virtual XRootDStatus Rm( const std::string &path,
417  ResponseHandler *handler,
418  time_t timeout )
419  {
420  (void)path; (void)handler; (void)timeout;
422  }
423 
424  //------------------------------------------------------------------------
426  //------------------------------------------------------------------------
427  virtual XRootDStatus MkDir( const std::string &path,
428  MkDirFlags::Flags flags,
429  Access::Mode mode,
430  ResponseHandler *handler,
431  time_t timeout )
432  {
433  (void)path; (void)flags; (void)mode; (void)handler; (void)timeout;
435  }
436 
437  //------------------------------------------------------------------------
439  //------------------------------------------------------------------------
440  virtual XRootDStatus RmDir( const std::string &path,
441  ResponseHandler *handler,
442  time_t timeout )
443  {
444  (void)path; (void)handler; (void)timeout;
446  }
447 
448  //------------------------------------------------------------------------
450  //------------------------------------------------------------------------
451  virtual XRootDStatus ChMod( const std::string &path,
452  Access::Mode mode,
453  ResponseHandler *handler,
454  time_t timeout )
455  {
456  (void)path; (void)mode; (void)handler; (void)timeout;
458  }
459 
460  //------------------------------------------------------------------------
462  //------------------------------------------------------------------------
463  virtual XRootDStatus Ping( ResponseHandler *handler,
464  time_t timeout )
465  {
466  (void)handler; (void)timeout;
468  }
469 
470  //------------------------------------------------------------------------
472  //------------------------------------------------------------------------
473  virtual XRootDStatus Stat( const std::string &path,
474  ResponseHandler *handler,
475  time_t timeout )
476  {
477  (void)path; (void)handler; (void)timeout;
479  }
480 
481  //------------------------------------------------------------------------
483  //------------------------------------------------------------------------
484  virtual XRootDStatus StatVFS( const std::string &path,
485  ResponseHandler *handler,
486  time_t timeout )
487  {
488  (void)path; (void)handler; (void)timeout;
490  }
491 
492  //------------------------------------------------------------------------
494  //------------------------------------------------------------------------
496  time_t timeout = 0 )
497  {
498  (void)handler; (void)timeout;
500  }
501 
502  //------------------------------------------------------------------------
504  //------------------------------------------------------------------------
505  virtual XRootDStatus DirList( const std::string &path,
506  DirListFlags::Flags flags,
507  ResponseHandler *handler,
508  time_t timeout )
509  {
510  (void)path; (void)flags; (void)handler; (void)timeout;
512  }
513 
514  //------------------------------------------------------------------------
516  //------------------------------------------------------------------------
517  virtual XRootDStatus SendInfo( const std::string &info,
518  ResponseHandler *handler,
519  time_t timeout )
520  {
521  (void)info; (void)handler; (void)timeout;
523  }
524 
525  //------------------------------------------------------------------------
527  //------------------------------------------------------------------------
528  virtual XRootDStatus Prepare( const std::vector<std::string> &fileList,
529  PrepareFlags::Flags flags,
530  uint8_t priority,
531  ResponseHandler *handler,
532  time_t timeout )
533  {
534  (void)fileList; (void)flags; (void)priority; (void)handler;
535  (void)timeout;
537  }
538 
539  //------------------------------------------------------------------------
541  //------------------------------------------------------------------------
542  virtual XRootDStatus SetXAttr( const std::string &path,
543  const std::vector<xattr_t> &attrs,
544  ResponseHandler *handler,
545  time_t timeout )
546  {
547  (void)path; (void)attrs; (void)handler; (void)timeout;
549  }
550 
551  //------------------------------------------------------------------------
553  //------------------------------------------------------------------------
554  virtual XRootDStatus GetXAttr( const std::string &path,
555  const std::vector<std::string> &attrs,
556  ResponseHandler *handler,
557  time_t timeout )
558  {
559  (void)path; (void)attrs; (void)handler; (void)timeout;
561  }
562 
563  //------------------------------------------------------------------------
565  //------------------------------------------------------------------------
566  virtual XRootDStatus DelXAttr( const std::string &path,
567  const std::vector<std::string> &attrs,
568  ResponseHandler *handler,
569  time_t timeout )
570  {
571  (void)path; (void)attrs; (void)handler; (void)timeout;
573  }
574 
575  //------------------------------------------------------------------------
577  //------------------------------------------------------------------------
578  virtual XRootDStatus ListXAttr( const std::string &path,
579  ResponseHandler *handler,
580  time_t timeout )
581  {
582  (void)path; (void)handler; (void)timeout;
584  }
585 
586  //------------------------------------------------------------------------
588  //------------------------------------------------------------------------
589  virtual bool SetProperty( const std::string &name,
590  const std::string &value )
591  {
592  (void)name; (void)value;
593  return false;
594  }
595 
596  //------------------------------------------------------------------------
598  //------------------------------------------------------------------------
599  virtual bool GetProperty( const std::string &name,
600  std::string &value ) const
601  {
602  (void)name; (void)value;
603  return false;
604  }
605  };
606 
607  //----------------------------------------------------------------------------
609  //----------------------------------------------------------------------------
611  {
612  public:
613  //------------------------------------------------------------------------
615  //------------------------------------------------------------------------
616  virtual ~PlugInFactory() {}
617 
618  //------------------------------------------------------------------------
620  //------------------------------------------------------------------------
621  virtual FilePlugIn *CreateFile( const std::string &url ) = 0;
622 
623  //------------------------------------------------------------------------
625  //------------------------------------------------------------------------
626  virtual FileSystemPlugIn *CreateFileSystem( const std::string &url ) = 0;
627  };
628 }
629 
630 #endif // __XRD_CL_PLUGIN_INTERFACE__
Binary blob representation.
Definition: XrdClBuffer.hh:34
An interface for file plug-ins.
virtual XRootDStatus Visa(ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Open(const std::string &url, OpenFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Fcntl(QueryCode::Code queryCode, const Buffer &arg, ResponseHandler *handler, time_t timeout)
virtual bool IsOpen() const
virtual XRootDStatus PgRead(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Write(uint64_t offset, uint32_t size, Optional< uint64_t > fdoff, int fd, ResponseHandler *handler, time_t timeout=0)
virtual XRootDStatus Fcntl(const Buffer &arg, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Close(ResponseHandler *handler, time_t timeout)
virtual XRootDStatus PreRead(const TractList &tracts, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Read(uint64_t offset, uint32_t size, Optional< uint64_t > fdoff, int fd, ResponseHandler *handler, time_t timeout=0)
virtual XRootDStatus Truncate(uint64_t size, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus OpenUsingTemplate(ExportedFileTemplate *templ, const std::string &url, OpenFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, time_t timeout)
virtual bool GetProperty(const std::string &name, std::string &value) const
virtual XRootDStatus Stat(bool force, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus VectorWrite(const ChunkList &chunks, ResponseHandler *handler, time_t timeout=0)
virtual XRootDStatus Clone(const CloneLocations &locs, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Write(uint64_t offset, Buffer &&buffer, ResponseHandler *handler, time_t timeout=0)
virtual bool SetProperty(const std::string &name, const std::string &value)
virtual XRootDStatus Sync(ResponseHandler *handler, time_t timeout)
virtual std::unique_ptr< ExportedFileTemplate > ExportTemplate() const
virtual XRootDStatus WriteV(uint64_t offset, const struct iovec *iov, int iovcnt, ResponseHandler *handler, time_t timeout=0)
virtual XRootDStatus Read(uint64_t offset, uint32_t size, void *buffer, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Write(uint64_t offset, uint32_t size, const void *buffer, ResponseHandler *handler, time_t timeout)
virtual ~FilePlugIn()
Destructor.
virtual XRootDStatus PgWrite(uint64_t offset, uint32_t nbpgs, const void *buffer, std::vector< uint32_t > &cksums, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus VectorRead(const ChunkList &chunks, void *buffer, ResponseHandler *handler, time_t timeout)
An interface for file plug-ins.
virtual XRootDStatus Query(QueryCode::Code queryCode, const Buffer &arg, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Rm(const std::string &path, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus RmDir(const std::string &path, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Prepare(const std::vector< std::string > &fileList, PrepareFlags::Flags flags, uint8_t priority, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Truncate(const std::string &path, uint64_t size, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Protocol(ResponseHandler *handler, time_t timeout=0)
virtual XRootDStatus StatVFS(const std::string &path, ResponseHandler *handler, time_t timeout)
virtual bool GetProperty(const std::string &name, std::string &value) const
virtual XRootDStatus ListXAttr(const std::string &path, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus SendInfo(const std::string &info, ResponseHandler *handler, time_t timeout)
virtual bool SetProperty(const std::string &name, const std::string &value)
virtual XRootDStatus GetXAttr(const std::string &path, const std::vector< std::string > &attrs, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus DelXAttr(const std::string &path, const std::vector< std::string > &attrs, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Stat(const std::string &path, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Mv(const std::string &source, const std::string &dest, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Locate(const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus MkDir(const std::string &path, MkDirFlags::Flags flags, Access::Mode mode, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus SetXAttr(const std::string &path, const std::vector< xattr_t > &attrs, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus Ping(ResponseHandler *handler, time_t timeout)
virtual ~FileSystemPlugIn()
Destructor.
virtual XRootDStatus DirList(const std::string &path, DirListFlags::Flags flags, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus ChMod(const std::string &path, Access::Mode mode, ResponseHandler *handler, time_t timeout)
virtual XRootDStatus DeepLocate(const std::string &path, OpenFlags::Flags flags, ResponseHandler *handler, time_t timeout)
virtual ~PlugInFactory()
Destructor.
virtual FilePlugIn * CreateFile(const std::string &url)=0
Create a file plug-in for the given URL.
virtual FileSystemPlugIn * CreateFileSystem(const std::string &url)=0
Create a file system plug-in for the given URL.
Handle an async response.
const uint16_t errNotImplemented
Operation is not implemented.
Definition: XrdClStatus.hh:64
const uint16_t stError
An error occurred that could potentially be retried.
Definition: XrdClStatus.hh:32
std::vector< TractInfo > TractList
List of Tracts.
std::vector< ChunkInfo > ChunkList
List of chunks.
Mode
Access mode.
Flags
Open flags, may be or'd when appropriate.
Code
XRootD query request codes.