CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XrdFile.h
Go to the documentation of this file.
1 #ifndef Utilities_XrdAdaptor_XrdFile_h
2 #define Utilities_XrdAdaptor_XrdFile_h
3 
7 # include "XrdClient/XrdClient.hh"
8 # include <string>
9 # include <pthread.h>
10 
11 class XrdFile : public Storage
12 {
13 public:
14  XrdFile (void);
15  XrdFile (IOFD fd);
16  XrdFile (const char *name, int flags = IOFlags::OpenRead, int perms = 0666);
17  XrdFile (const std::string &name, int flags = IOFlags::OpenRead, int perms = 0666);
18  ~XrdFile (void);
19 
20  virtual void create (const char *name,
21  bool exclusive = false,
22  int perms = 0666);
23  virtual void create (const std::string &name,
24  bool exclusive = false,
25  int perms = 0666);
26  virtual void open (const char *name,
28  int perms = 0666);
29  virtual void open (const std::string &name,
31  int perms = 0666);
32 
33  using Storage::read;
34  using Storage::readv;
35  using Storage::write;
36  using Storage::position;
37 
38  virtual bool prefetch (const IOPosBuffer *what, IOSize n);
39  virtual IOSize read (void *into, IOSize n);
40  virtual IOSize read (void *into, IOSize n, IOOffset pos);
41  virtual IOSize readv (IOBuffer *into, IOSize n);
42  virtual IOSize readv (IOPosBuffer *into, IOSize n);
43  virtual IOSize write (const void *from, IOSize n);
44  virtual IOSize write (const void *from, IOSize n, IOOffset pos);
45 
46  virtual IOOffset position (IOOffset offset, Relative whence = SET);
47  virtual void resize (IOOffset size);
48 
49  virtual void close (void);
50  virtual void abort (void);
51 
52 private:
53 
55 
56  // "Real" implementation of readv that interacts directly with Xrootd.
57  IOSize readv_send(char **result_buffer, readahead_list &read_chunk_list, IOSize n, IOSize total_len);
58  IOSize readv_unpack(char **result_buffer, std::vector<char> &res_buf, IOSize datalen, readahead_list &read_chunk_list, IOSize n);
59 
60 
61  XrdClient *m_client;
63  XrdClientStatInfo m_stat;
64  bool m_close;
66 
67  // We could do away with this.. if not for the race condition with LastServerResp in XrdReadv.
68  pthread_mutex_t m_readv_mutex;
69 
70 };
71 
72 #endif // XRD_ADAPTOR_XRD_FILE_H
virtual void resize(IOOffset size)
Definition: XrdFile.cc:397
virtual IOSize readv(IOPosBuffer *into, IOSize buffers)
Definition: Storage.cc:31
virtual void close(void)
Definition: XrdFile.cc:189
IOSize readv_send(char **result_buffer, readahead_list &read_chunk_list, IOSize n, IOSize total_len)
Definition: XrdReadv.cc:160
XrdClientStatInfo m_stat
Definition: XrdFile.h:63
virtual void create(const char *name, bool exclusive=false, int perms=0666)
Definition: XrdFile.cc:62
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
bool m_close
Definition: XrdFile.h:64
IOOffset m_offset
Definition: XrdFile.h:62
Relative
Definition: Storage.h:23
virtual bool prefetch(const IOPosBuffer *what, IOSize n)
Definition: XrdFile.cc:332
virtual IOSize write(const void *from, IOSize n, IOOffset pos)
Definition: Storage.cc:59
XrdFile(void)
Definition: XrdFile.cc:12
virtual IOOffset position(void) const
Definition: Storage.cc:95
virtual IOSize readv(IOBuffer *into, IOSize n)
Definition: XrdReadv.cc:43
int read(void)
Definition: IOInput.cc:54
unsigned int offset(bool)
XrdClient * m_client
Definition: XrdFile.h:61
std::string m_name
Definition: XrdFile.h:65
~XrdFile(void)
Definition: XrdFile.cc:51
virtual IOOffset size(void) const
Definition: Storage.cc:102
int64_t IOOffset
Definition: IOTypes.h:19
int IOFD
Definition: IOTypes.h:22
pthread_mutex_t m_readv_mutex
Definition: XrdFile.h:68
IOSize readv_unpack(char **result_buffer, std::vector< char > &res_buf, IOSize datalen, readahead_list &read_chunk_list, IOSize n)
Definition: XrdReadv.cc:205
size_t IOSize
Definition: IOTypes.h:14
void addConnection(cms::Exception &)
Definition: XrdFile.cc:407
virtual void open(const char *name, int flags=IOFlags::OpenRead, int perms=0666)
Definition: XrdFile.cc:90
virtual IOSize write(const void *from, IOSize n)
Definition: XrdFile.cc:277
virtual void abort(void)
Definition: XrdFile.cc:215