Logo
lblock_manager.hh
Go to the documentation of this file.
1 #pragma once
2 #include "local_io.hh"
3 #include "../messages/IOoperation.hh"
4 #include <string>
5 #include <mutex>
6 #include <map>
7 
8 #define BLOCK_SIZE 8388608
9 
10 const int default_shm_id = 85549;
11 
12 struct shm_info {
13 // char *buf; //[BLOCK_SIZE];
14  char buf[BLOCK_SIZE];
15  uint64_t chunk_size;
16  uint32_t chunk_index;
17  bool commit;
18 };
19 
20 struct task {
21  std::shraed_ptr<std::ifstream> fd;
22  std::vector<eclipse::messages::BlockInfo> assigned_chunks;
23 };
24 
26 private :
27  std::vector<struct task> tasks;
28  std::thread lbm_master;
29  std::vector<std::thread> lbm_workers;
30  std::vector<std::shread_ptr<std::mutex> > locks;
31  bool processing;
32 public :
33 
34  lblock_manager() : processing(false);
35 
36  void lblock_manager_init_task(string file, std::vector<eclipse::messages::BlockInfo>& assigned_chunks, int task_id);
37  void lbm_read(int task_id);
38  void lblock_manager_stop_task(int task_id);
39  bool lblock_manager_destroy_task(int task_id);
40 
42 
43 
44 };
45 
46 
Definition: lblock_manager.hh:25
void lblock_manager_stop_task(int task_id)
bool lblock_manager_destroy_task(int task_id)
lblock_manager() void lblock_manager_init_task(string file, std::vector< eclipse::messages::BlockInfo > &assigned_chunks, int task_id)
void lbm_read(int task_id)
const int default_shm_id
Definition: lblock_manager.hh:10
#define BLOCK_SIZE
Definition: lblock_manager.hh:8
Definition: lblock_manager.hh:12
uint32_t chunk_index
Definition: lblock_manager.hh:16
char buf[BLOCK_SIZE]
Definition: lblock_manager.hh:14
uint64_t chunk_size
Definition: lblock_manager.hh:15
bool commit
Definition: lblock_manager.hh:17
Definition: lblock_manager.hh:20
std::vector< eclipse::messages::BlockInfo > assigned_chunks
Definition: lblock_manager.hh:22
std::shraed_ptr< std::ifstream > fd
Definition: lblock_manager.hh:21