-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamo.proto
135 lines (100 loc) · 2.57 KB
/
dynamo.proto
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
syntax = "proto3";
// The document of proto3: https://developers.google.com/protocol-buffers/docs/proto3
// 包名定义, Python中使用时可以省略不写
// Package name definition, which can be omitted in Python.
package dynamo;
message GetRequest {
int64 client_id = 1;
int64 key = 2;
int64 coord_nid = 3;
int64 hinted_handoff = 4;
}
message VectorClockItem {
string server_id = 1;
int64 count = 2;
}
message HeartbeatRequest {
int64 sent_to = 1;
int64 from_n = 2;
bool succ = 3;
}
message VectorClock {
repeated VectorClockItem clock = 1;
}
message ReadItem {
string val = 1;
VectorClock context = 2;
}
message PutRequest {
int64 client_id = 1;
int64 key = 2;
string val = 3;
VectorClock context = 4; // TODO: replace with List[Tuple(server, count)]
string metadata = 5;
int64 coord_nid = 6;
int64 hinted_handoff = 7;
}
message GetResponse {
int64 server_id = 1;
repeated ReadItem items = 2;
string metadata = 3; // message confirming delivery
bool reroute = 4;
int64 reroute_server_id = 5;
bool succ = 6;
}
message ReadResponse {
int64 server_id = 1;
ReadItem item = 2;
string metadata = 3;
bool succ = 4;
}
message PutResponse {
int64 server_id = 1;
string metadata = 2; // message confirming delivery
bool reroute = 3;
int64 reroute_server_id = 4;
bool succ = 5;
VectorClock context = 6;
}
message ReplicateResponse {
int64 server_id = 1;
string metadata = 2; // message confirming delivery
bool succ = 3;
}
message KeyValStore {
int64 key= 1;
}
message NoParams {
}
message Memory {
map<int64, PutRequest> mem = 1;
}
message MemResponse {
map<int64, PutRequest> mem = 1;
map<int64, Memory> mem_replicated = 2;
}
message FailRequest {
bool fail = 1;
}
message DataBunchResponse {
int64 sent_from = 3;
bool succ = 2;
}
message DataBunchRequest {
int64 sent_from = 1;
repeated PutRequest requests = 2;
}
service DynamoInterface {
rpc Put (PutRequest) returns (PutResponse);
rpc Get (GetRequest) returns (GetResponse);
rpc Read (GetRequest) returns (ReadResponse);
rpc Heartbeat (HeartbeatRequest) returns (HeartbeatRequest);
rpc Replicate (PutRequest) returns (ReplicateResponse);
rpc TransferData(DataBunchRequest) returns (DataBunchResponse);
// debuggin functions
rpc PrintMemory (NoParams) returns (MemResponse);
rpc Fail (FailRequest) returns (FailRequest);
rpc Gossip(NoParams) returns (NoParams);
rpc PutStreaming (stream PutRequest) returns (stream PutResponse);
rpc GetStreaming (stream GetRequest) returns (stream GetResponse);
}