raft.proto 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. syntax = "proto2";
  2. package raftpb;
  3. import "gogoproto/gogo.proto";
  4. option (gogoproto.marshaler_all) = true;
  5. option (gogoproto.sizer_all) = true;
  6. option (gogoproto.unmarshaler_all) = true;
  7. option (gogoproto.goproto_getters_all) = false;
  8. option (gogoproto.goproto_enum_prefix_all) = false;
  9. enum EntryType {
  10. EntryNormal = 0;
  11. EntryConfChange = 1;
  12. }
  13. message Entry {
  14. optional EntryType Type = 1 [(gogoproto.nullable) = false];
  15. optional uint64 Term = 2 [(gogoproto.nullable) = false];
  16. optional uint64 Index = 3 [(gogoproto.nullable) = false];
  17. optional bytes Data = 4;
  18. }
  19. message SnapshotMetadata {
  20. optional ConfState conf_state = 1 [(gogoproto.nullable) = false];
  21. optional uint64 index = 2 [(gogoproto.nullable) = false];
  22. optional uint64 term = 3 [(gogoproto.nullable) = false];
  23. }
  24. message Snapshot {
  25. optional bytes data = 1;
  26. optional SnapshotMetadata metadata = 2 [(gogoproto.nullable) = false];
  27. }
  28. enum MessageType {
  29. MsgHup = 0;
  30. MsgBeat = 1;
  31. MsgProp = 2;
  32. MsgApp = 3;
  33. MsgAppResp = 4;
  34. MsgVote = 5;
  35. MsgVoteResp = 6;
  36. MsgSnap = 7;
  37. MsgHeartbeat = 8;
  38. MsgHeartbeatResp = 9;
  39. MsgUnreachable = 10;
  40. MsgSnapStatus = 11;
  41. MsgCheckQuorum = 12;
  42. }
  43. message Message {
  44. optional MessageType type = 1 [(gogoproto.nullable) = false];
  45. optional uint64 to = 2 [(gogoproto.nullable) = false];
  46. optional uint64 from = 3 [(gogoproto.nullable) = false];
  47. optional uint64 term = 4 [(gogoproto.nullable) = false];
  48. optional uint64 logTerm = 5 [(gogoproto.nullable) = false];
  49. optional uint64 index = 6 [(gogoproto.nullable) = false];
  50. repeated Entry entries = 7 [(gogoproto.nullable) = false];
  51. optional uint64 commit = 8 [(gogoproto.nullable) = false];
  52. optional Snapshot snapshot = 9 [(gogoproto.nullable) = false];
  53. optional bool reject = 10 [(gogoproto.nullable) = false];
  54. optional uint64 rejectHint = 11 [(gogoproto.nullable) = false];
  55. }
  56. message HardState {
  57. optional uint64 term = 1 [(gogoproto.nullable) = false];
  58. optional uint64 vote = 2 [(gogoproto.nullable) = false];
  59. optional uint64 commit = 3 [(gogoproto.nullable) = false];
  60. }
  61. message ConfState {
  62. repeated uint64 nodes = 1;
  63. }
  64. enum ConfChangeType {
  65. ConfChangeAddNode = 0;
  66. ConfChangeRemoveNode = 1;
  67. ConfChangeUpdateNode = 2;
  68. }
  69. message ConfChange {
  70. optional uint64 ID = 1 [(gogoproto.nullable) = false];
  71. optional ConfChangeType Type = 2 [(gogoproto.nullable) = false];
  72. optional uint64 NodeID = 3 [(gogoproto.nullable) = false];
  73. optional bytes Context = 4;
  74. }