Add RAFT stuff

This commit is contained in:
Piv
2020-02-21 21:08:50 +10:30
parent 18a5a33b5f
commit e13551f798
17 changed files with 1156 additions and 0 deletions

35
MyRaft/protos/raft.proto Normal file
View File

@@ -0,0 +1,35 @@
syntax = "proto3";
package raft;
service Raft{
rpc AppendEntriesRPC(AppendEntries) returns (AppendEntriesResponse) {}
rpc RequestVoteRPC(RequestVote) returns (RequestVoteResponse) {}
}
message AppendEntries{
uint32 term = 1;
string leaderId = 2;
uint32 prevLogIndex = 3;
uint32 prevLogTerm = 4;
uint32 leaderCommit = 5;
repeated string entry = 6;
}
message AppendEntriesResponse{
uint32 term = 1;
bool success = 2;
}
message RequestVote{
uint32 term = 1;
string candidateId = 2;
uint32 lastLogIndex = 3;
uint32 lastLogTerm = 4;
}
message RequestVoteResponse{
uint32 term = 1;
bool voteGranted = 2;
string voterId = 3;
}