-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathraft.proto
66 lines (56 loc) · 1.65 KB
/
raft.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
/*
* Copyright (C) 2019 Open Whisper Systems
* Copyright (C) 2021 jessa0
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
syntax = "proto2";
package raft.protobufs;
message RaftMessage {
required TermId term = 2;
oneof rpc {
VoteRequest vote_request = 3;
VoteResponse vote_response = 4;
AppendRequest append_request = 5;
AppendResponse append_response = 6;
};
}
message VoteRequest {
required LogIndex last_log_idx = 2;
required TermId last_log_term = 3;
}
message VoteResponse {
required bool vote_granted = 2;
}
message AppendRequest {
required LogIndex prev_log_idx = 1;
required TermId prev_log_term = 2;
required LogIndex leader_commit = 3;
repeated LogEntry entries = 4;
}
message AppendResponse {
required bool success = 1;
required LogIndex match_idx = 2;
required LogIndex last_log_idx = 3;
}
message LogEntry {
required TermId term = 1;
required bytes data = 2;
}
message TermId {
required uint64 id = 1;
}
message LogIndex {
required uint64 id = 1;
}