优化数据库节点管理

This commit is contained in:
GoEdgeLab
2021-08-30 10:57:03 +08:00
parent aaa05805a8
commit a25a937c0a
4 changed files with 280 additions and 81 deletions

View File

@@ -157,9 +157,10 @@ type DBNodeStatus struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"`
Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
IsOk bool `protobuf:"varint,1,opt,name=isOk,proto3" json:"isOk,omitempty"`
Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
Version string `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"`
}
func (x *DBNodeStatus) Reset() {
@@ -215,6 +216,13 @@ func (x *DBNodeStatus) GetError() string {
return ""
}
func (x *DBNodeStatus) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
var File_models_model_db_node_proto protoreflect.FileDescriptor
var file_models_model_db_node_proto_rawDesc = []byte{
@@ -238,13 +246,14 @@ var file_models_model_db_node_proto_rawDesc = []byte{
0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x72, 0x73, 0x65, 0x74, 0x12, 0x28, 0x0a, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62,
0x2e, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73,
0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x4c, 0x0a, 0x0c, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x66, 0x0a, 0x0c, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x04, 0x69, 0x73, 0x4f, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x14, 0x0a,
0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72,
0x72, 0x6f, 0x72, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x72, 0x6f, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0x06, 0x5a,
0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@@ -800,6 +800,101 @@ func (x *TruncateDBNodeTableRequest) GetDbNodeTable() string {
return ""
}
// 检查数据库节点状态
type CheckDBNodeStatusRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
DbNodeId int64 `protobuf:"varint,1,opt,name=dbNodeId,proto3" json:"dbNodeId,omitempty"`
}
func (x *CheckDBNodeStatusRequest) Reset() {
*x = CheckDBNodeStatusRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_service_db_node_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CheckDBNodeStatusRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckDBNodeStatusRequest) ProtoMessage() {}
func (x *CheckDBNodeStatusRequest) ProtoReflect() protoreflect.Message {
mi := &file_service_db_node_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckDBNodeStatusRequest.ProtoReflect.Descriptor instead.
func (*CheckDBNodeStatusRequest) Descriptor() ([]byte, []int) {
return file_service_db_node_proto_rawDescGZIP(), []int{13}
}
func (x *CheckDBNodeStatusRequest) GetDbNodeId() int64 {
if x != nil {
return x.DbNodeId
}
return 0
}
type CheckDBNodeStatusResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
DbNodeStatus *DBNodeStatus `protobuf:"bytes,1,opt,name=dbNodeStatus,proto3" json:"dbNodeStatus,omitempty"`
}
func (x *CheckDBNodeStatusResponse) Reset() {
*x = CheckDBNodeStatusResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_service_db_node_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CheckDBNodeStatusResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CheckDBNodeStatusResponse) ProtoMessage() {}
func (x *CheckDBNodeStatusResponse) ProtoReflect() protoreflect.Message {
mi := &file_service_db_node_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CheckDBNodeStatusResponse.ProtoReflect.Descriptor instead.
func (*CheckDBNodeStatusResponse) Descriptor() ([]byte, []int) {
return file_service_db_node_proto_rawDescGZIP(), []int{14}
}
func (x *CheckDBNodeStatusResponse) GetDbNodeStatus() *DBNodeStatus {
if x != nil {
return x.DbNodeStatus
}
return nil
}
var File_service_db_node_proto protoreflect.FileDescriptor
var file_service_db_node_proto_rawDesc = []byte{
@@ -887,50 +982,64 @@ var file_service_db_node_proto_rawDesc = []byte{
0x62, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64,
0x62, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x62, 0x4e, 0x6f, 0x64,
0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x62,
0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x32, 0xa0, 0x05, 0x0a, 0x0d, 0x44, 0x42,
0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63,
0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x62,
0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37,
0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17,
0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43,
0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x37, 0x0a, 0x0c, 0x64, 0x65, 0x6c, 0x65, 0x74,
0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x22, 0x36, 0x0a, 0x18, 0x43, 0x68, 0x65,
0x63, 0x6b, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x62, 0x4e, 0x6f, 0x64, 0x65, 0x49,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x64, 0x62, 0x4e, 0x6f, 0x64, 0x65, 0x49,
0x64, 0x22, 0x51, 0x0a, 0x19, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34,
0x0a, 0x0c, 0x64, 0x62, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65,
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0c, 0x64, 0x62, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x32, 0xf2, 0x05, 0x0a, 0x0d, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x53,
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65,
0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61,
0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
0x18, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64,
0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x75, 0x70, 0x64,
0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x55,
0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x12, 0x37, 0x0a, 0x0c, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f,
0x64, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x42,
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62,
0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x51, 0x0a, 0x16, 0x63,
0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42,
0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50,
0x43, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53,
0x0a, 0x12, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e,
0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e,
0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61,
0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69,
0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x13, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c,
0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x12, 0x1e, 0x2e, 0x70,
0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x54,
0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70,
0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x54,
0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a,
0x11, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62,
0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x42,
0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73,
0x12, 0x51, 0x0a, 0x16, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62,
0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x21, 0x2e, 0x70, 0x62, 0x2e,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44,
0x42, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e,
0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x12, 0x6c, 0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c,
0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x4c,
0x69, 0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x69,
0x73, 0x74, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64,
0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1c, 0x2e,
0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42,
0x4e, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62,
0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x44, 0x42, 0x4e, 0x6f,
0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x13, 0x66, 0x69,
0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65,
0x73, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x44, 0x42,
0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x44, 0x42,
0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x41, 0x0a, 0x11, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f,
0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c,
0x65, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75,
0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x45, 0x0a, 0x13, 0x74, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74,
0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1e, 0x2e, 0x70,
0x62, 0x2e, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65,
0x54, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70,
0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04,
0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x12, 0x45, 0x0a, 0x13, 0x74, 0x72, 0x75, 0x6e, 0x63, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f,
0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x72, 0x75,
0x6e, 0x63, 0x61, 0x74, 0x65, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x54, 0x61, 0x62, 0x6c, 0x65,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43,
0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x50, 0x0a, 0x11, 0x63, 0x68, 0x65, 0x63, 0x6b,
0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x70,
0x62, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61,
0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e,
0x43, 0x68, 0x65, 0x63, 0x6b, 0x44, 0x42, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -945,7 +1054,7 @@ func file_service_db_node_proto_rawDescGZIP() []byte {
return file_service_db_node_proto_rawDescData
}
var file_service_db_node_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_service_db_node_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_service_db_node_proto_goTypes = []interface{}{
(*CreateDBNodeRequest)(nil), // 0: pb.CreateDBNodeRequest
(*CreateDBNodeResponse)(nil), // 1: pb.CreateDBNodeResponse
@@ -960,38 +1069,44 @@ var file_service_db_node_proto_goTypes = []interface{}{
(*FindAllDBNodeTablesResponse)(nil), // 10: pb.FindAllDBNodeTablesResponse
(*DeleteDBNodeTableRequest)(nil), // 11: pb.DeleteDBNodeTableRequest
(*TruncateDBNodeTableRequest)(nil), // 12: pb.TruncateDBNodeTableRequest
(*DBNode)(nil), // 13: pb.DBNode
(*DBTable)(nil), // 14: pb.DBTable
(*RPCSuccess)(nil), // 15: pb.RPCSuccess
(*RPCCountResponse)(nil), // 16: pb.RPCCountResponse
(*CheckDBNodeStatusRequest)(nil), // 13: pb.CheckDBNodeStatusRequest
(*CheckDBNodeStatusResponse)(nil), // 14: pb.CheckDBNodeStatusResponse
(*DBNode)(nil), // 15: pb.DBNode
(*DBTable)(nil), // 16: pb.DBTable
(*DBNodeStatus)(nil), // 17: pb.DBNodeStatus
(*RPCSuccess)(nil), // 18: pb.RPCSuccess
(*RPCCountResponse)(nil), // 19: pb.RPCCountResponse
}
var file_service_db_node_proto_depIdxs = []int32{
13, // 0: pb.ListEnabledDBNodesResponse.dbNodes:type_name -> pb.DBNode
13, // 1: pb.FindEnabledDBNodeResponse.dbNode:type_name -> pb.DBNode
14, // 2: pb.FindAllDBNodeTablesResponse.dbNodeTables:type_name -> pb.DBTable
0, // 3: pb.DBNodeService.createDBNode:input_type -> pb.CreateDBNodeRequest
2, // 4: pb.DBNodeService.updateDBNode:input_type -> pb.UpdateDBNodeRequest
3, // 5: pb.DBNodeService.deleteDBNode:input_type -> pb.DeleteDBNodeRequest
4, // 6: pb.DBNodeService.countAllEnabledDBNodes:input_type -> pb.CountAllEnabledDBNodesRequest
5, // 7: pb.DBNodeService.listEnabledDBNodes:input_type -> pb.ListEnabledDBNodesRequest
7, // 8: pb.DBNodeService.findEnabledDBNode:input_type -> pb.FindEnabledDBNodeRequest
9, // 9: pb.DBNodeService.findAllDBNodeTables:input_type -> pb.FindAllDBNodeTablesRequest
11, // 10: pb.DBNodeService.deleteDBNodeTable:input_type -> pb.DeleteDBNodeTableRequest
12, // 11: pb.DBNodeService.truncateDBNodeTable:input_type -> pb.TruncateDBNodeTableRequest
1, // 12: pb.DBNodeService.createDBNode:output_type -> pb.CreateDBNodeResponse
15, // 13: pb.DBNodeService.updateDBNode:output_type -> pb.RPCSuccess
15, // 14: pb.DBNodeService.deleteDBNode:output_type -> pb.RPCSuccess
16, // 15: pb.DBNodeService.countAllEnabledDBNodes:output_type -> pb.RPCCountResponse
6, // 16: pb.DBNodeService.listEnabledDBNodes:output_type -> pb.ListEnabledDBNodesResponse
8, // 17: pb.DBNodeService.findEnabledDBNode:output_type -> pb.FindEnabledDBNodeResponse
10, // 18: pb.DBNodeService.findAllDBNodeTables:output_type -> pb.FindAllDBNodeTablesResponse
15, // 19: pb.DBNodeService.deleteDBNodeTable:output_type -> pb.RPCSuccess
15, // 20: pb.DBNodeService.truncateDBNodeTable:output_type -> pb.RPCSuccess
12, // [12:21] is the sub-list for method output_type
3, // [3:12] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
15, // 0: pb.ListEnabledDBNodesResponse.dbNodes:type_name -> pb.DBNode
15, // 1: pb.FindEnabledDBNodeResponse.dbNode:type_name -> pb.DBNode
16, // 2: pb.FindAllDBNodeTablesResponse.dbNodeTables:type_name -> pb.DBTable
17, // 3: pb.CheckDBNodeStatusResponse.dbNodeStatus:type_name -> pb.DBNodeStatus
0, // 4: pb.DBNodeService.createDBNode:input_type -> pb.CreateDBNodeRequest
2, // 5: pb.DBNodeService.updateDBNode:input_type -> pb.UpdateDBNodeRequest
3, // 6: pb.DBNodeService.deleteDBNode:input_type -> pb.DeleteDBNodeRequest
4, // 7: pb.DBNodeService.countAllEnabledDBNodes:input_type -> pb.CountAllEnabledDBNodesRequest
5, // 8: pb.DBNodeService.listEnabledDBNodes:input_type -> pb.ListEnabledDBNodesRequest
7, // 9: pb.DBNodeService.findEnabledDBNode:input_type -> pb.FindEnabledDBNodeRequest
9, // 10: pb.DBNodeService.findAllDBNodeTables:input_type -> pb.FindAllDBNodeTablesRequest
11, // 11: pb.DBNodeService.deleteDBNodeTable:input_type -> pb.DeleteDBNodeTableRequest
12, // 12: pb.DBNodeService.truncateDBNodeTable:input_type -> pb.TruncateDBNodeTableRequest
13, // 13: pb.DBNodeService.checkDBNodeStatus:input_type -> pb.CheckDBNodeStatusRequest
1, // 14: pb.DBNodeService.createDBNode:output_type -> pb.CreateDBNodeResponse
18, // 15: pb.DBNodeService.updateDBNode:output_type -> pb.RPCSuccess
18, // 16: pb.DBNodeService.deleteDBNode:output_type -> pb.RPCSuccess
19, // 17: pb.DBNodeService.countAllEnabledDBNodes:output_type -> pb.RPCCountResponse
6, // 18: pb.DBNodeService.listEnabledDBNodes:output_type -> pb.ListEnabledDBNodesResponse
8, // 19: pb.DBNodeService.findEnabledDBNode:output_type -> pb.FindEnabledDBNodeResponse
10, // 20: pb.DBNodeService.findAllDBNodeTables:output_type -> pb.FindAllDBNodeTablesResponse
18, // 21: pb.DBNodeService.deleteDBNodeTable:output_type -> pb.RPCSuccess
18, // 22: pb.DBNodeService.truncateDBNodeTable:output_type -> pb.RPCSuccess
14, // 23: pb.DBNodeService.checkDBNodeStatus:output_type -> pb.CheckDBNodeStatusResponse
14, // [14:24] is the sub-list for method output_type
4, // [4:14] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_service_db_node_proto_init() }
@@ -1159,6 +1274,30 @@ func file_service_db_node_proto_init() {
return nil
}
}
file_service_db_node_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CheckDBNodeStatusRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_service_db_node_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CheckDBNodeStatusResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -1166,7 +1305,7 @@ func file_service_db_node_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_service_db_node_proto_rawDesc,
NumEnums: 0,
NumMessages: 13,
NumMessages: 15,
NumExtensions: 0,
NumServices: 1,
},
@@ -1210,6 +1349,8 @@ type DBNodeServiceClient interface {
DeleteDBNodeTable(ctx context.Context, in *DeleteDBNodeTableRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
// 清空表
TruncateDBNodeTable(ctx context.Context, in *TruncateDBNodeTableRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
// 检查数据库节点状态
CheckDBNodeStatus(ctx context.Context, in *CheckDBNodeStatusRequest, opts ...grpc.CallOption) (*CheckDBNodeStatusResponse, error)
}
type dBNodeServiceClient struct {
@@ -1301,6 +1442,15 @@ func (c *dBNodeServiceClient) TruncateDBNodeTable(ctx context.Context, in *Trunc
return out, nil
}
func (c *dBNodeServiceClient) CheckDBNodeStatus(ctx context.Context, in *CheckDBNodeStatusRequest, opts ...grpc.CallOption) (*CheckDBNodeStatusResponse, error) {
out := new(CheckDBNodeStatusResponse)
err := c.cc.Invoke(ctx, "/pb.DBNodeService/checkDBNodeStatus", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// DBNodeServiceServer is the server API for DBNodeService service.
type DBNodeServiceServer interface {
// 创建数据库节点
@@ -1321,6 +1471,8 @@ type DBNodeServiceServer interface {
DeleteDBNodeTable(context.Context, *DeleteDBNodeTableRequest) (*RPCSuccess, error)
// 清空表
TruncateDBNodeTable(context.Context, *TruncateDBNodeTableRequest) (*RPCSuccess, error)
// 检查数据库节点状态
CheckDBNodeStatus(context.Context, *CheckDBNodeStatusRequest) (*CheckDBNodeStatusResponse, error)
}
// UnimplementedDBNodeServiceServer can be embedded to have forward compatible implementations.
@@ -1354,6 +1506,9 @@ func (*UnimplementedDBNodeServiceServer) DeleteDBNodeTable(context.Context, *Del
func (*UnimplementedDBNodeServiceServer) TruncateDBNodeTable(context.Context, *TruncateDBNodeTableRequest) (*RPCSuccess, error) {
return nil, status.Errorf(codes.Unimplemented, "method TruncateDBNodeTable not implemented")
}
func (*UnimplementedDBNodeServiceServer) CheckDBNodeStatus(context.Context, *CheckDBNodeStatusRequest) (*CheckDBNodeStatusResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CheckDBNodeStatus not implemented")
}
func RegisterDBNodeServiceServer(s *grpc.Server, srv DBNodeServiceServer) {
s.RegisterService(&_DBNodeService_serviceDesc, srv)
@@ -1521,6 +1676,24 @@ func _DBNodeService_TruncateDBNodeTable_Handler(srv interface{}, ctx context.Con
return interceptor(ctx, in, info, handler)
}
func _DBNodeService_CheckDBNodeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CheckDBNodeStatusRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DBNodeServiceServer).CheckDBNodeStatus(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/pb.DBNodeService/CheckDBNodeStatus",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DBNodeServiceServer).CheckDBNodeStatus(ctx, req.(*CheckDBNodeStatusRequest))
}
return interceptor(ctx, in, info, handler)
}
var _DBNodeService_serviceDesc = grpc.ServiceDesc{
ServiceName: "pb.DBNodeService",
HandlerType: (*DBNodeServiceServer)(nil),
@@ -1561,6 +1734,10 @@ var _DBNodeService_serviceDesc = grpc.ServiceDesc{
MethodName: "truncateDBNodeTable",
Handler: _DBNodeService_TruncateDBNodeTable_Handler,
},
{
MethodName: "checkDBNodeStatus",
Handler: _DBNodeService_CheckDBNodeStatus_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "service_db_node.proto",

View File

@@ -21,4 +21,5 @@ message DBNodeStatus {
bool isOk = 1;
int64 size = 2;
string error = 3;
string version = 4;
}

View File

@@ -34,6 +34,9 @@ service DBNodeService {
// 清空表
rpc truncateDBNodeTable (TruncateDBNodeTableRequest) returns (RPCSuccess);
// 检查数据库节点状态
rpc checkDBNodeStatus(CheckDBNodeStatusRequest) returns (CheckDBNodeStatusResponse);
}
// 创建数据库节点
@@ -115,4 +118,13 @@ message DeleteDBNodeTableRequest {
message TruncateDBNodeTableRequest {
int64 dbNodeId = 1;
string dbNodeTable = 2;
}
// 检查数据库节点状态
message CheckDBNodeStatusRequest {
int64 dbNodeId = 1;
}
message CheckDBNodeStatusResponse {
DBNodeStatus dbNodeStatus = 1;
}