-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraft.proto
More file actions
78 lines (59 loc) · 1.32 KB
/
raft.proto
File metadata and controls
78 lines (59 loc) · 1.32 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
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
syntax = "proto3";
// python3 -m grpc_tools.protoc raft.proto --proto_path=. --python_out=. --grpc_python_out=.
service RaftElectionService {
rpc RequestVote(VoteRequest) returns (VoteResponse);
rpc AppendEntries(AppendRequest) returns (AppendResponse);
rpc GetLeader(Void) returns (GetLeaderResponse);
rpc Suspend(SuspendRequest) returns (Void);
rpc SetVal(KeyValue) returns (SetValResponse);
rpc GetVal(Key) returns (GetValResponse);
}
message VoteRequest {
uint64 candidateTerm = 1;
uint64 candidateId = 2;
uint64 lastLogIndex = 3;
uint64 lastLogTerm = 4;
}
message VoteResponse {
uint64 term = 1;
bool result = 2;
}
message AppendRequest {
uint64 leaderTerm = 1;
uint64 leaderId = 2;
uint64 prevLogIndex = 3;
uint64 prevLogTerm = 4;
repeated LogEntry entries = 5;
uint64 leaderCommitIndex = 6;
}
message AppendResponse {
uint64 term = 1;
bool success = 2;
uint64 ack = 3;
}
message Void {}
message GetLeaderResponse {
uint64 nodeId = 1;
string nodeAddress = 2;
}
message SuspendRequest {
uint64 period = 1;
}
message Key {
string key = 1;
}
message KeyValue {
string key = 1;
string value = 2;
}
message LogEntry {
KeyValue keyValue = 1;
uint64 term = 2;
}
message SetValResponse {
bool success = 1;
}
message GetValResponse {
bool success = 1;
string value = 2;
}