forked from manzali/lseb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder_unit.h
More file actions
47 lines (37 loc) · 1.03 KB
/
Copy pathbuilder_unit.h
File metadata and controls
47 lines (37 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef BU_BUILDER_UNIT_H
#define BU_BUILDER_UNIT_H
#include <map>
#include <sys/uio.h>
#include <boost/lockfree/spsc_queue.hpp>
#include "transport/transport.h"
#include "transport/endpoints.h"
namespace lseb {
class BuilderUnit {
boost::lockfree::spsc_queue<iovec>& m_free_local_queue;
boost::lockfree::spsc_queue<iovec>& m_ready_local_queue;
std::vector<Endpoint> m_endpoints;
std::map<int, std::unique_ptr<RecvSocket> > m_connection_ids;
std::vector<std::vector<iovec> > m_data_vect;
int m_bulk_size;
int m_credits;
int m_max_fragment_size;
int m_id;
Acceptor<RecvSocket> m_acceptor;
std::unique_ptr<unsigned char[]> m_data_ptr;
int read_data(int id);
bool check_data();
size_t release_data(int id, int n);
public:
BuilderUnit(
boost::lockfree::spsc_queue<iovec>& free_local_data,
boost::lockfree::spsc_queue<iovec>& ready_local_data,
std::vector<Endpoint> const& endpoints,
int bulk_size,
int credits,
int max_fragment_size,
int id);
void connect();
void run();
};
}
#endif