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;
}