feat: region lease (#49)

* feat: region lease

* feat: region lease

* feat: region lease
This commit is contained in:
LFC
2023-06-14 19:33:35 +08:00
committed by GitHub
parent 4398d20c56
commit abb1d0a8f3
4 changed files with 322 additions and 122 deletions
+109 -34
View File
@@ -390,6 +390,61 @@ func (x *TableName) GetTableName() string {
return ""
}
type TableIdent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TableId uint32 `protobuf:"varint,1,opt,name=table_id,json=tableId,proto3" json:"table_id,omitempty"`
TableName *TableName `protobuf:"bytes,2,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"`
}
func (x *TableIdent) Reset() {
*x = TableIdent{}
if protoimpl.UnsafeEnabled {
mi := &file_greptime_v1_meta_common_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TableIdent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TableIdent) ProtoMessage() {}
func (x *TableIdent) ProtoReflect() protoreflect.Message {
mi := &file_greptime_v1_meta_common_proto_msgTypes[5]
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 TableIdent.ProtoReflect.Descriptor instead.
func (*TableIdent) Descriptor() ([]byte, []int) {
return file_greptime_v1_meta_common_proto_rawDescGZIP(), []int{5}
}
func (x *TableIdent) GetTableId() uint32 {
if x != nil {
return x.TableId
}
return 0
}
func (x *TableIdent) GetTableName() *TableName {
if x != nil {
return x.TableName
}
return nil
}
type TimeInterval struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -404,7 +459,7 @@ type TimeInterval struct {
func (x *TimeInterval) Reset() {
*x = TimeInterval{}
if protoimpl.UnsafeEnabled {
mi := &file_greptime_v1_meta_common_proto_msgTypes[5]
mi := &file_greptime_v1_meta_common_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -417,7 +472,7 @@ func (x *TimeInterval) String() string {
func (*TimeInterval) ProtoMessage() {}
func (x *TimeInterval) ProtoReflect() protoreflect.Message {
mi := &file_greptime_v1_meta_common_proto_msgTypes[5]
mi := &file_greptime_v1_meta_common_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -430,7 +485,7 @@ func (x *TimeInterval) ProtoReflect() protoreflect.Message {
// Deprecated: Use TimeInterval.ProtoReflect.Descriptor instead.
func (*TimeInterval) Descriptor() ([]byte, []int) {
return file_greptime_v1_meta_common_proto_rawDescGZIP(), []int{5}
return file_greptime_v1_meta_common_proto_rawDescGZIP(), []int{6}
}
func (x *TimeInterval) GetStartTimestampMillis() int64 {
@@ -461,7 +516,7 @@ type KeyValue struct {
func (x *KeyValue) Reset() {
*x = KeyValue{}
if protoimpl.UnsafeEnabled {
mi := &file_greptime_v1_meta_common_proto_msgTypes[6]
mi := &file_greptime_v1_meta_common_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -474,7 +529,7 @@ func (x *KeyValue) String() string {
func (*KeyValue) ProtoMessage() {}
func (x *KeyValue) ProtoReflect() protoreflect.Message {
mi := &file_greptime_v1_meta_common_proto_msgTypes[6]
mi := &file_greptime_v1_meta_common_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -487,7 +542,7 @@ func (x *KeyValue) ProtoReflect() protoreflect.Message {
// Deprecated: Use KeyValue.ProtoReflect.Descriptor instead.
func (*KeyValue) Descriptor() ([]byte, []int) {
return file_greptime_v1_meta_common_proto_rawDescGZIP(), []int{6}
return file_greptime_v1_meta_common_proto_rawDescGZIP(), []int{7}
}
func (x *KeyValue) GetKey() []byte {
@@ -542,24 +597,30 @@ var file_greptime_v1_meta_common_proto_rawDesc = []byte{
0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x6d,
0x61, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65,
0x4e, 0x61, 0x6d, 0x65, 0x22, 0x76, 0x0a, 0x0c, 0x54, 0x69, 0x6d, 0x65, 0x49, 0x6e, 0x74, 0x65,
0x72, 0x76, 0x61, 0x6c, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69,
0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x18, 0x01,
0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73,
0x74, 0x61, 0x6d, 0x70, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x65, 0x6e,
0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6d, 0x69, 0x6c, 0x6c,
0x69, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x22, 0x32, 0x0a, 0x08,
0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x2a, 0x22, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x41, 0x54, 0x41,
0x4e, 0x4f, 0x44, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x52, 0x4f, 0x4e, 0x54, 0x45,
0x4e, 0x44, 0x10, 0x01, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f,
0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67,
0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65,
0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x4e, 0x61, 0x6d, 0x65, 0x22, 0x63, 0x0a, 0x0a, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x49, 0x64, 0x65,
0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x3a, 0x0a,
0x0a, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x0b, 0x32, 0x1b, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e,
0x6d, 0x65, 0x74, 0x61, 0x2e, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x52, 0x09,
0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x76, 0x0a, 0x0c, 0x54, 0x69, 0x6d,
0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x34, 0x0a, 0x16, 0x73, 0x74, 0x61,
0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6d, 0x69, 0x6c,
0x6c, 0x69, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x73, 0x74, 0x61, 0x72, 0x74,
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x12,
0x30, 0x0a, 0x14, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
0x5f, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x65,
0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x69, 0x6c, 0x6c, 0x69,
0x73, 0x22, 0x32, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x22, 0x0a, 0x04, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x0c, 0x0a,
0x08, 0x44, 0x41, 0x54, 0x41, 0x4e, 0x4f, 0x44, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x46,
0x52, 0x4f, 0x4e, 0x54, 0x45, 0x4e, 0x44, 0x10, 0x01, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74,
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65,
0x54, 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f,
0x76, 0x31, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -575,7 +636,7 @@ func file_greptime_v1_meta_common_proto_rawDescGZIP() []byte {
}
var file_greptime_v1_meta_common_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_greptime_v1_meta_common_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_greptime_v1_meta_common_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_greptime_v1_meta_common_proto_goTypes = []interface{}{
(Role)(0), // 0: greptime.v1.meta.Role
(*RequestHeader)(nil), // 1: greptime.v1.meta.RequestHeader
@@ -583,17 +644,19 @@ var file_greptime_v1_meta_common_proto_goTypes = []interface{}{
(*Error)(nil), // 3: greptime.v1.meta.Error
(*Peer)(nil), // 4: greptime.v1.meta.Peer
(*TableName)(nil), // 5: greptime.v1.meta.TableName
(*TimeInterval)(nil), // 6: greptime.v1.meta.TimeInterval
(*KeyValue)(nil), // 7: greptime.v1.meta.KeyValue
(*TableIdent)(nil), // 6: greptime.v1.meta.TableIdent
(*TimeInterval)(nil), // 7: greptime.v1.meta.TimeInterval
(*KeyValue)(nil), // 8: greptime.v1.meta.KeyValue
}
var file_greptime_v1_meta_common_proto_depIdxs = []int32{
0, // 0: greptime.v1.meta.RequestHeader.role:type_name -> greptime.v1.meta.Role
3, // 1: greptime.v1.meta.ResponseHeader.error:type_name -> greptime.v1.meta.Error
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
5, // 2: greptime.v1.meta.TableIdent.table_name:type_name -> greptime.v1.meta.TableName
3, // [3:3] is the sub-list for method output_type
3, // [3:3] 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
}
func init() { file_greptime_v1_meta_common_proto_init() }
@@ -663,7 +726,7 @@ func file_greptime_v1_meta_common_proto_init() {
}
}
file_greptime_v1_meta_common_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TimeInterval); i {
switch v := v.(*TableIdent); i {
case 0:
return &v.state
case 1:
@@ -675,6 +738,18 @@ func file_greptime_v1_meta_common_proto_init() {
}
}
file_greptime_v1_meta_common_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*TimeInterval); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_greptime_v1_meta_common_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*KeyValue); i {
case 0:
return &v.state
@@ -693,7 +768,7 @@ func file_greptime_v1_meta_common_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_greptime_v1_meta_common_proto_rawDesc,
NumEnums: 1,
NumMessages: 7,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},