-
Notifications
You must be signed in to change notification settings - Fork 0
/
mr_protocol.h
59 lines (45 loc) · 1.08 KB
/
mr_protocol.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
50
51
52
53
54
55
56
57
58
#ifndef mr_protocol_h_
#define mr_protocol_h_
#include <string>
#include <vector>
#include "rpc.h"
using namespace std;
#define REDUCER_COUNT 4
enum mr_tasktype {
NONE = 0, // this flag means no task needs to be performed at this point
MAP,
REDUCE
};
class mr_protocol {
public:
typedef int status;
enum xxstatus { OK, RPCERR, NOENT, IOERR };
enum rpc_numbers {
asktask = 0xa001,
submittask,
};
struct AskTaskResponse {
// Lab4: Your definition here.
int tasktype;
int index;
int nfiles;
string filename;
};
friend unmarshall &operator>>(unmarshall &u, AskTaskResponse &res){
return u >> res.tasktype >> res.filename >> res.index >> res.nfiles;
}
friend marshall &operator<<(marshall &m, const AskTaskResponse &res){
return m << res.tasktype << res.filename << res.index << res.nfiles;
}
struct AskTaskRequest {
// Lab4: Your definition here.
int index;
};
struct SubmitTaskResponse {
// Lab4: Your definition here.
};
struct SubmitTaskRequest {
// Lab4: Your definition here.
};
};
#endif