-
Notifications
You must be signed in to change notification settings - Fork 0
/
gopaxos.proto
120 lines (100 loc) · 2.44 KB
/
gopaxos.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
syntax = "proto3";
package gopaxos;
option go_package = "./";
// the service replicas provide to clients
service Replica {
rpc Write (Message) returns (Message) {}
rpc Read (Message) returns (Message) {}
rpc Collect (Message) returns (Message) {}
rpc Decide (Message) returns (Message) {}
}
service ReplicaLeader {
rpc Propose (Message) returns (Message) {}
rpc Collect (Message) returns (Message) {}
rpc Heartbeat (Message) returns (Message) {} // THIS IS NOT FOR REPLICA BUT FOR LEADERS
}
service LeaderAcceptor {
rpc Scouting (Message) returns (Message) {}
rpc Commanding (Message) returns (Message) {}
}
message Message {
int32 type = 1;
int32 clientId = 2;
int64 commandId = 3;
string key = 4;
string value = 5;
Command command = 6;
bool valid = 7;
repeated Response responses = 8;
Decision decision = 9;
int32 ballotNumber = 10;
int32 ballotLeader = 11;
int32 slotNumber = 12;
int32 leaderId = 13;
int32 acceptorId = 14;
BSC bsc = 15;
repeated BSC accepted = 16;
bool active = 17;
string content = 18;
Message req = 19;
bool send = 20;
}
message Command {
int32 type = 1;
int32 clientId = 2;
int64 commandId = 3;
string key = 4;
string value = 5;
}
// should not send response to client until the command's slot is decided
message Response {
Command command = 1;
}
message Responses {
bool valid = 1;
repeated Response responses = 2;
}
message Proposal {
int32 slotNumber = 1;
Command command = 2;
}
// Why we need to send the entire command message?
// because a replica may receive decisions not in its command pool
message Decision {
int32 slotNumber = 1;
Command command = 2;
}
message Decisions {
bool valid = 1;
repeated Decision decisions = 2;
}
message BSC {
int32 ballotNumber = 1;
int32 slotNumber = 2;
Command command = 3;
}
message P1a {
int32 leaderId = 1;
int32 ballotNumber = 2;
}
message P1b {
int32 acceptorId = 1;
int32 ballotNumber = 2;
int32 ballotLeader = 3;
repeated BSC accepted = 4;
}
message P2a {
int32 leaderId = 1;
BSC bsc = 2;
}
message P2b {
int32 acceptorId = 1;
int32 ballotNumber = 2;
int32 ballotLeader = 3;
}
message Beat {
bool active = 1;
}
message Empty {
string content = 1;
}