CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
XrdFile.h
Go to the documentation of this file.
1 #ifndef Utilities_XrdAdaptor_XrdFile_h
2 #define Utilities_XrdAdaptor_XrdFile_h
3 
8 #include "XrdCl/XrdClFile.hh"
9 #include <string>
10 #include <memory>
11 #include <atomic>
12 
13 namespace XrdAdaptor {
14  class RequestManager;
15 }
16 
17 namespace edm::storage {
18  class XrdFile : public Storage {
19  public:
20  XrdFile(void);
21  XrdFile(IOFD fd);
22  XrdFile(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
23  XrdFile(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
24  ~XrdFile(void) override;
25 
26  virtual void create(const char *name, bool exclusive = false, int perms = 0666);
27  virtual void create(const std::string &name, bool exclusive = false, int perms = 0666);
28  virtual void open(const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
29  virtual void open(const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
30 
31  using Storage::position;
32  using Storage::read;
33  using Storage::readv;
34  using Storage::write;
35 
36  bool prefetch(const IOPosBuffer *what, IOSize n) override;
37  IOSize read(void *into, IOSize n) override;
38  IOSize read(void *into, IOSize n, IOOffset pos) override;
39  IOSize readv(IOBuffer *into, IOSize n) override;
40  IOSize readv(IOPosBuffer *into, IOSize n) override;
41  IOSize write(const void *from, IOSize n) override;
42  IOSize write(const void *from, IOSize n, IOOffset pos) override;
43 
44  IOOffset position(IOOffset offset, Relative whence = SET) override;
45  void resize(IOOffset size) override;
46 
47  void close(void) override;
48  virtual void abort(void);
49 
50  private:
52 
57  std::shared_ptr<XrdCl::File> getActiveFile();
58 
62  bool m_close;
64  std::atomic<unsigned int> m_op_count;
65  };
66 } // namespace edm::storage
67 
68 #endif // XRD_ADAPTOR_XRD_FILE_H
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: XrdFile.cc:42
int64_t IOOffset
Definition: IOTypes.h:20
std::string m_name
Definition: XrdFile.h:63
std::atomic< unsigned int > m_op_count
Definition: XrdFile.h:64
virtual IOSize readv(IOBuffer *into, IOSize buffers)
Definition: Storage.cc:146
virtual IOOffset size() const
Definition: Storage.cc:509
bool prefetch(const IOPosBuffer *what, IOSize n) override
Definition: XrdFile.cc:450
std::shared_ptr< XrdCl::File > getActiveFile()
Definition: XrdFile.cc:507
void resize(IOOffset size) override
Definition: XrdFile.cc:499
IOSize write(const void *from, IOSize n) override
Definition: XrdFile.cc:397
IOOffset m_offset
Definition: XrdFile.h:60
virtual IOOffset position() const
Definition: Storage.cc:504
tuple fd
Definition: ztee.py:136
void addConnection(cms::Exception &)
Definition: XrdFile.cc:519
void close(void) override
Definition: XrdFile.cc:155
size_t IOSize
Definition: IOTypes.h:15
IOSize write(unsigned char byte)
Definition: Storage.cc:329
virtual void abort(void)
Definition: XrdFile.cc:170
IOSize readv(IOBuffer *into, IOSize n) override
Definition: XrdFile.cc:256
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: XrdFile.cc:58
int IOFD
Definition: IOTypes.h:23
edm::propagate_const< std::shared_ptr< XrdAdaptor::RequestManager > > m_requestmanager
Definition: XrdFile.h:59
~XrdFile(void) override
Definition: XrdFile.cc:36