feat: rpc message based heartbeat (#30)

* feat: rpc message based heartbeat

* chore: by cr
This commit is contained in:
JeremyHi
2023-04-26 18:59:45 +08:00
committed by GitHub
parent a26c40c004
commit e8abf8241c
3 changed files with 27 additions and 3 deletions
+8 -2
View File
@@ -10,6 +10,12 @@ message RequestHeader {
uint64 cluster_id = 2;
// member_id is the ID of the sender server.
uint64 member_id = 3;
Role role = 4;
}
enum Role {
DATANODE = 0;
FRONTEND = 1;
}
message ResponseHeader {
@@ -37,9 +43,9 @@ message TableName {
message TimeInterval {
// The unix timestamp in millis of the start of this period.
uint64 start_timestamp_millis = 1;
int64 start_timestamp_millis = 1;
// The unix timestamp in millis of the end of this period.
uint64 end_timestamp_millis = 2;
int64 end_timestamp_millis = 2;
}
message KeyValue {
+18 -1
View File
@@ -32,6 +32,7 @@ message HeartbeatRequest {
repeated RegionStat region_stats = 6;
// Follower nodes and stats, empty on follower nodes
repeated ReplicaStat replica_stats = 7;
repeated MailboxMessage mailbox_messages = 8;
}
message NodeStat {
@@ -80,7 +81,7 @@ message ReplicaStat {
message HeartbeatResponse {
ResponseHeader header = 1;
repeated bytes payload = 2;
repeated MailboxMessage mailbox_messages = 2;
}
message AskLeaderRequest {
@@ -92,3 +93,19 @@ message AskLeaderResponse {
Peer leader = 2;
}
message MailboxMessage {
// The id is used to associate request and response.
uint64 id = 1;
// The following information plays a bigger role in making messages traceable and facilitating debugging.
string subject = 2;
string from = 3;
string to = 4;
// The unix timestamp in milliseconds.
int64 timestamp_millis = 5;
// The message body.
oneof payload {
string json = 6;
}
}
+1
View File
@@ -62,6 +62,7 @@ impl RequestHeader {
protocol_version: PROTOCOL_VERSION,
cluster_id,
member_id,
role: 0,
}
}
}