syntax = "proto3"; package raftpb; enum EntryType { EntryNormal = 0; EntryConfChange = 1; } message Entry { uint64 term = 1; // must be 64-bit aligned for atomic operations uint64 index = 2; // must be 64-bit aligned for atomic operations EntryType entry_type = 3; bytes data = 4; } message SnapshotMetadata { ConfState conf_state = 1; uint64 index = 2; uint64 term = 3; } message Snapshot { bytes data = 1; SnapshotMetadata metadata = 2; } message ConfState { repeated uint64 nodes = 1; repeated uint64 learners = 2; } enum MessageType { MsgHup = 0; MsgBeat = 1; MsgProp = 2; MsgApp = 3; MsgAppResp = 4; MsgVote = 5; MsgVoteResp = 6; MsgSnap = 7; MsgHeartbeat = 8; MsgHeartbeatResp = 9; MsgUnreachable = 10; MsgSnapStatus = 11; MsgCheckQuorum = 12; MsgTransferLeader = 13; MsgTimeoutNow = 14; MsgReadIndex = 15; MsgReadIndexResp = 16; MsgPreVote = 17; MsgPreVoteResp = 18; } message HardState { uint64 term = 1; uint64 vote = 2; uint64 commit = 3; } enum ConfChangeType { ConfChangeAddNode = 0; ConfChangeRemoveNode = 1; ConfChangeUpdateNode = 2; ConfChangeAddLearnerNode = 3; } message Message { MessageType msg_type = 1; uint64 to = 2; uint64 from = 3; uint64 term = 4; // leader’s term uint64 log_term = 5; // term of prevLogIndex entry uint64 index = 6; // index of log entry immediately preceding new ones repeated Entry entries = 7; // log entries to store (empty for heartbeat; may send more than one for efficiency) uint64 commit = 8; // leader’s commitIndex Snapshot snapshot = 9; bool reject = 10; uint64 reject_hint = 11; bytes context = 12; } message ConfChange { uint64 id = 1; ConfChangeType change_type = 2; uint64 node_id = 3; bytes context = 4; }