-
Notifications
You must be signed in to change notification settings - Fork 0
/
extent_server_dist.h
49 lines (39 loc) · 1.61 KB
/
extent_server_dist.h
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
48
49
// this is the extent server
#ifndef extent_server_dist_h
#define extent_server_dist_h
#include "extent_protocol.h"
#include <map>
#include <string>
#include "raft.h"
#include "extent_server.h"
#include "raft_test_utils.h"
#include "chfs_state_machine.h"
using chfs_raft = raft<chfs_state_machine, chfs_command_raft>;
using chfs_raft_group = raft_group<chfs_state_machine, chfs_command_raft>;
class extent_server_dist {
#define EXTENT_SERVER_DIST_LOG(fmt, args...) \
do { \
} while (0);
//#define EXTENT_SERVER_DIST_LOG(fmt, args...) \
// do { \
// printf("[extent_server_dist][%s:%d:%s] " fmt "\n", __FILE__, __LINE__, __FUNCTION__ , ##args); \
// } while (0);
private:
const int cv_timeout_milliseconds = 1000;
const int sleep_interval_milliseconds = 20;
public:
chfs_raft_group *raft_group;
extent_server_dist(const int num_raft_nodes = 3) {
EXTENT_SERVER_DIST_LOG("step in");
raft_group = new chfs_raft_group(num_raft_nodes);
EXTENT_SERVER_DIST_LOG("chfs_raft_group successfully created");
};
chfs_raft *leader() const;
int create(uint32_t type, extent_protocol::extentid_t &id);
int put(extent_protocol::extentid_t id, std::string, int &);
int get(extent_protocol::extentid_t id, std::string &);
int getattr(extent_protocol::extentid_t id, extent_protocol::attr &);
int remove(extent_protocol::extentid_t id, int &);
~extent_server_dist();
};
#endif