FlashGraph-ng
A new frontier in large-scale graph analysis and data mining
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
direct_comp_access.h
1 #ifndef __COMP_ACCESS_H__
2 #define __COMP_ACCESS_H__
3 
23 #include "container.h"
24 
25 #include "io_interface.h"
26 
27 namespace safs
28 {
29 
30 class remote_io;
31 class comp_io_scheduler;
32 class direct_byte_array_allocator;
33 
39 {
40  size_t num_disk_bytes;
41  size_t num_req_bytes;
42  size_t num_issued_areqs;
43  size_t num_completed_areqs;
44 
45  // The memory that have been allocated for the I/O requests that have
46  // been issued to the underlying I/O.
47  size_t alloc_mem_size;
48  fifo_queue<io_request> req_buf;
49  std::shared_ptr<remote_io> underlying;
50  std::shared_ptr<comp_io_scheduler> comp_sched;
51  std::unique_ptr<direct_byte_array_allocator> arr_alloc;
52 
53  void process_buf_reqs();
54  void process_incomplete_computes();
55 public:
56  direct_comp_io(std::shared_ptr<remote_io> io);
57  ~direct_comp_io();
58 
59  /*
60  * This method is called when an I/O request is completed by
61  * the underlying I/O.
62  */
63  void complete_req(const io_request &req);
64 
65  virtual int get_file_id() const;
66  virtual void cleanup();
67  virtual bool support_aio() {
68  return true;
69  }
70 
71  virtual void access(io_request *requests, int num,
72  io_status *status = NULL);
73  virtual void flush_requests();
74  virtual int wait4complete(int num);
75  virtual int num_pending_ios() const;
76 
77  size_t get_num_disk_bytes() {
78  return num_disk_bytes;
79  }
80 
81  size_t get_num_req_bytes() {
82  return num_req_bytes;
83  }
84 
85  size_t get_num_reqs() {
86  return num_issued_areqs;
87  }
88 
89  size_t get_num_completed_reqs() {
90  return num_completed_areqs;
91  }
92 };
93 
94 }
95 
96 #endif
Definition: io_interface.h:65
Definition: io_request.h:491
virtual int wait4complete(int num)
virtual void flush_requests()
virtual void access(io_request *requests, int num, io_status *status=NULL)
Definition: io_interface.h:154
virtual int get_file_id() const
virtual void cleanup()
Definition: direct_comp_access.h:38
virtual bool support_aio()
Definition: direct_comp_access.h:67
virtual int num_pending_ios() const