raft.proto 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. syntax = "proto2";
  2. package raftpb;
  3. import "github.com/gogo/protobuf/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. }
  42. message Message {
  43. optional MessageType type = 1 [(gogoproto.nullable) = false];
  44. optional uint64 to = 2 [(gogoproto.nullable) = false];
  45. optional uint64 from = 3 [(gogoproto.nullable) = false];
  46. optional uint64 term = 4 [(gogoproto.nullable) = false];
  47. optional uint64 logTerm = 5 [(gogoproto.nullable) = false];
  48. optional uint64 index = 6 [(gogoproto.nullable) = false];
  49. repeated Entry entries = 7 [(gogoproto.nullable) = false];
  50. optional uint64 commit = 8 [(gogoproto.nullable) = false];
  51. optional Snapshot snapshot = 9 [(gogoproto.nullable) = false];
  52. optional bool reject = 10 [(gogoproto.nullable) = false];
  53. optional uint64 rejectHint = 11 [(gogoproto.nullable) = false];
  54. }
  55. message HardState {
  56. optional uint64 term = 1 [(gogoproto.nullable) = false];
  57. optional uint64 vote = 2 [(gogoproto.nullable) = false];
  58. optional uint64 commit = 3 [(gogoproto.nullable) = false];
  59. }
  60. message ConfState {
  61. repeated uint64 nodes = 1;
  62. }
  63. enum ConfChangeType {
  64. ConfChangeAddNode = 0;
  65. ConfChangeRemoveNode = 1;
  66. ConfChangeUpdateNode = 2;
  67. }
  68. message ConfChange {
  69. optional uint64 ID = 1 [(gogoproto.nullable) = false];
  70. optional ConfChangeType Type = 2 [(gogoproto.nullable) = false];
  71. optional uint64 NodeID = 3 [(gogoproto.nullable) = false];
  72. optional bytes Context = 4;
  73. }