154 lines
3.3 KiB
Protocol Buffer
154 lines
3.3 KiB
Protocol Buffer
syntax = "proto2";
|
|
package alisql;
|
|
|
|
message LogEntry
|
|
{
|
|
required uint64 term = 1;
|
|
required uint64 index = 2;
|
|
required uint64 opType = 3;
|
|
optional bytes ikey = 4;
|
|
optional bytes value = 5;
|
|
optional uint64 info = 6;
|
|
optional uint64 checksum = 7;
|
|
/* Reserve: optional uint32 groupId = 8; */
|
|
optional bytes opaque = 9;
|
|
}
|
|
|
|
message RDSFields
|
|
{
|
|
optional uint32 rdsServerId = 1;
|
|
optional uint32 source = 2;
|
|
}
|
|
|
|
message PolarFields
|
|
{
|
|
required uint32 version = 1;
|
|
required uint64 start_lsn = 2;
|
|
optional bytes extra_value = 3;
|
|
}
|
|
|
|
message CompressedLogEntries
|
|
{
|
|
required uint32 type = 1;
|
|
required uint32 rawSize = 2;
|
|
required bytes data = 3;
|
|
optional uint32 checksum = 4;
|
|
}
|
|
|
|
message ConfigureChangeValue
|
|
{
|
|
optional int32 ccType = 1;
|
|
optional int32 opType = 2;
|
|
repeated bytes addrs = 3;
|
|
repeated bytes allServers = 4;
|
|
repeated bytes allLearners = 5;
|
|
optional uint64 serverId = 6;
|
|
optional uint32 forceSync = 7;
|
|
optional uint32 electionWeight = 8;
|
|
optional uint64 learnerSource = 9;
|
|
optional bool applyMode = 10;
|
|
}
|
|
|
|
message ClusterInfoEntry
|
|
{
|
|
required uint64 serverId = 1;
|
|
optional uint64 matchIndex = 2;
|
|
optional uint64 nextIndex = 3;
|
|
optional uint32 role = 4;
|
|
optional uint64 hasVoted = 5;
|
|
optional uint32 forceSync = 6;
|
|
optional uint32 electionWeight = 7;
|
|
optional uint64 learnerSource = 8;
|
|
optional uint64 appliedIndex = 9;
|
|
optional uint32 pipelining = 10;
|
|
}
|
|
|
|
message PaxosMsg
|
|
{
|
|
//public members
|
|
optional uint64 configId = 1;
|
|
required uint64 clusterId = 2;
|
|
required uint64 serverId = 3;
|
|
required int32 msgType = 4;
|
|
required uint64 term = 5;
|
|
required uint64 msgId = 6;
|
|
|
|
//AppendEntries Request
|
|
optional uint64 leaderId = 7; //not used
|
|
optional uint64 prevLogIndex = 8;
|
|
optional uint64 prevLogTerm = 9;
|
|
repeated LogEntry entries = 10;
|
|
optional uint64 commitIndex = 11;
|
|
optional bool nocache = 12;
|
|
|
|
//AppendEntries Responce
|
|
optional bool isSuccess = 13;
|
|
//reuse lastlogindex as a hint when reject
|
|
|
|
//RequestVote Request
|
|
optional uint64 candidateId = 14; //not used
|
|
optional uint64 lastLogIndex = 15;
|
|
optional uint64 lastLogTerm = 16;
|
|
optional uint64 force = 17;
|
|
optional bytes addr = 18;
|
|
|
|
//RequestVote Responce
|
|
optional bool voteGranted = 19;
|
|
|
|
//Heartbeat Responce extra
|
|
optional bool ignoreCheck = 20;
|
|
|
|
//LeaderCommand
|
|
optional uint64 lcType = 21;
|
|
// LeaderTransfer: lastLogIndex/commitIndex
|
|
// PurgeLog: minMatchIndex
|
|
optional uint64 minMatchIndex = 22;
|
|
|
|
//LeaderCommandResponce
|
|
// lcType/lastLogIndex/commitIndex/isSuccess
|
|
|
|
//AppendEntries Responce
|
|
optional uint64 appliedIndex = 23;
|
|
|
|
//ClusterIdNotMatch
|
|
optional uint64 newClusterId = 24;
|
|
|
|
//Cluster info
|
|
repeated ClusterInfoEntry ciEntries = 25;
|
|
|
|
//For role check
|
|
optional uint32 role = 26;
|
|
|
|
// compressed log entries info
|
|
optional CompressedLogEntries compressedEntries = 27;
|
|
|
|
// extra custom info received from leader
|
|
// note that we already have addr = 18
|
|
optional bytes extra = 28;
|
|
|
|
/* Reserve: optional uint32 groupId = 29; */
|
|
|
|
/*
|
|
Field msgError passes enum type error code.
|
|
Extend it if necessary.
|
|
*/
|
|
enum MsgErrorType
|
|
{
|
|
NONE = 0;
|
|
APPEND = 1;
|
|
}
|
|
optional MsgErrorType msgError = 30;
|
|
};
|
|
|
|
message TestMsg1
|
|
{
|
|
required uint64 id = 1;
|
|
optional uint64 c1 = 2;
|
|
}
|
|
message TestMsg2
|
|
{
|
|
required uint64 id = 1;
|
|
optional uint64 c1 = 2;
|
|
repeated uint64 c2 = 3;
|
|
}
|