2015-06-30 04:37:52 +03:00
|
|
|
syntax = "proto2";
|
2014-08-28 05:53:18 +04:00
|
|
|
package raftpb;
|
2014-08-28 04:53:36 +04:00
|
|
|
|
2015-09-03 19:57:59 +03:00
|
|
|
import "gogoproto/gogo.proto";
|
2014-08-28 04:53:36 +04:00
|
|
|
|
|
|
|
option (gogoproto.marshaler_all) = true;
|
|
|
|
option (gogoproto.sizer_all) = true;
|
|
|
|
option (gogoproto.unmarshaler_all) = true;
|
|
|
|
option (gogoproto.goproto_getters_all) = false;
|
2014-09-21 09:48:17 +04:00
|
|
|
option (gogoproto.goproto_enum_prefix_all) = false;
|
2014-08-28 04:53:36 +04:00
|
|
|
|
2014-09-21 09:48:17 +04:00
|
|
|
enum EntryType {
|
2014-09-23 23:02:44 +04:00
|
|
|
EntryNormal = 0;
|
|
|
|
EntryConfChange = 1;
|
2014-09-21 09:48:17 +04:00
|
|
|
}
|
|
|
|
|
2014-08-28 04:53:36 +04:00
|
|
|
message Entry {
|
2016-07-08 21:13:53 +03:00
|
|
|
optional uint64 Term = 2 [(gogoproto.nullable) = false]; // must be 64-bit aligned for atomic operations
|
|
|
|
optional uint64 Index = 3 [(gogoproto.nullable) = false]; // must be 64-bit aligned for atomic operations
|
2015-06-30 02:05:55 +03:00
|
|
|
optional EntryType Type = 1 [(gogoproto.nullable) = false];
|
2015-06-30 04:37:52 +03:00
|
|
|
optional bytes Data = 4;
|
2014-08-28 04:53:36 +04:00
|
|
|
}
|
|
|
|
|
2014-11-20 00:17:50 +03:00
|
|
|
message SnapshotMetadata {
|
2015-06-30 02:05:55 +03:00
|
|
|
optional ConfState conf_state = 1 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 index = 2 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 term = 3 [(gogoproto.nullable) = false];
|
2014-11-20 00:17:50 +03:00
|
|
|
}
|
|
|
|
|
2014-08-28 04:53:36 +04:00
|
|
|
message Snapshot {
|
2015-06-30 04:37:52 +03:00
|
|
|
optional bytes data = 1;
|
|
|
|
optional SnapshotMetadata metadata = 2 [(gogoproto.nullable) = false];
|
2014-08-28 04:53:36 +04:00
|
|
|
}
|
|
|
|
|
2014-10-12 11:34:22 +04:00
|
|
|
enum MessageType {
|
2015-02-25 08:38:18 +03:00
|
|
|
MsgHup = 0;
|
|
|
|
MsgBeat = 1;
|
|
|
|
MsgProp = 2;
|
|
|
|
MsgApp = 3;
|
|
|
|
MsgAppResp = 4;
|
|
|
|
MsgVote = 5;
|
|
|
|
MsgVoteResp = 6;
|
|
|
|
MsgSnap = 7;
|
|
|
|
MsgHeartbeat = 8;
|
|
|
|
MsgHeartbeatResp = 9;
|
|
|
|
MsgUnreachable = 10;
|
|
|
|
MsgSnapStatus = 11;
|
2015-11-24 08:59:25 +03:00
|
|
|
MsgCheckQuorum = 12;
|
2016-03-24 14:59:41 +03:00
|
|
|
MsgTransferLeader = 13;
|
|
|
|
MsgTimeoutNow = 14;
|
2016-06-03 18:20:10 +03:00
|
|
|
MsgReadIndex = 15;
|
|
|
|
MsgReadIndexResp = 16;
|
2016-10-10 09:32:40 +03:00
|
|
|
MsgPreVote = 17;
|
|
|
|
MsgPreVoteResp = 18;
|
2014-10-12 11:34:22 +04:00
|
|
|
}
|
|
|
|
|
2014-08-28 04:53:36 +04:00
|
|
|
message Message {
|
2015-06-30 02:05:55 +03:00
|
|
|
optional MessageType type = 1 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 to = 2 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 from = 3 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 term = 4 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 logTerm = 5 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 index = 6 [(gogoproto.nullable) = false];
|
2014-12-31 06:42:59 +03:00
|
|
|
repeated Entry entries = 7 [(gogoproto.nullable) = false];
|
2015-06-30 02:05:55 +03:00
|
|
|
optional uint64 commit = 8 [(gogoproto.nullable) = false];
|
|
|
|
optional Snapshot snapshot = 9 [(gogoproto.nullable) = false];
|
|
|
|
optional bool reject = 10 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 rejectHint = 11 [(gogoproto.nullable) = false];
|
2016-07-12 11:14:06 +03:00
|
|
|
optional bytes context = 12;
|
2014-08-28 04:53:36 +04:00
|
|
|
}
|
2014-08-28 05:53:18 +04:00
|
|
|
|
2014-09-16 04:35:02 +04:00
|
|
|
message HardState {
|
2015-06-30 02:05:55 +03:00
|
|
|
optional uint64 term = 1 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 vote = 2 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 commit = 3 [(gogoproto.nullable) = false];
|
2014-08-28 05:53:18 +04:00
|
|
|
}
|
2014-09-23 01:38:21 +04:00
|
|
|
|
2014-11-20 00:17:50 +03:00
|
|
|
message ConfState {
|
2017-11-11 05:38:21 +03:00
|
|
|
repeated uint64 nodes = 1;
|
|
|
|
repeated uint64 learners = 2;
|
2014-11-20 00:17:50 +03:00
|
|
|
}
|
|
|
|
|
2014-09-23 23:02:44 +04:00
|
|
|
enum ConfChangeType {
|
2017-11-11 05:38:21 +03:00
|
|
|
ConfChangeAddNode = 0;
|
|
|
|
ConfChangeRemoveNode = 1;
|
|
|
|
ConfChangeUpdateNode = 2;
|
|
|
|
ConfChangeAddLearnerNode = 3;
|
2014-09-23 01:38:21 +04:00
|
|
|
}
|
|
|
|
|
2014-09-23 23:02:44 +04:00
|
|
|
message ConfChange {
|
2015-06-30 02:05:55 +03:00
|
|
|
optional uint64 ID = 1 [(gogoproto.nullable) = false];
|
|
|
|
optional ConfChangeType Type = 2 [(gogoproto.nullable) = false];
|
|
|
|
optional uint64 NodeID = 3 [(gogoproto.nullable) = false];
|
2015-06-30 04:37:52 +03:00
|
|
|
optional bytes Context = 4;
|
2014-09-23 01:38:21 +04:00
|
|
|
}
|