diff --git a/pkg/pb/metadata/metadata.pb.go b/pkg/pb/metadata/metadata.pb.go index 92d193766ad1a9803f69dc88ec3e1afacf7c4167..2cd37237fc05f7f32721c6d6c7ae4438f6c395af 100644 --- a/pkg/pb/metadata/metadata.pb.go +++ b/pkg/pb/metadata/metadata.pb.go @@ -24,6 +24,34 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// CNRole cn node role +type CNRole int32 + +const ( + // TP tp node + CNRole_TP CNRole = 0 + // AP ap node + CNRole_AP CNRole = 1 +) + +var CNRole_name = map[int32]string{ + 0: "TP", + 1: "AP", +} + +var CNRole_value = map[string]int32{ + "TP": 0, + "AP": 1, +} + +func (x CNRole) String() string { + return proto.EnumName(CNRole_name, int32(x)) +} + +func (CNRole) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_56d9f74966f40d04, []int{0} +} + // DNShardRecord is DN shard metadata describing what is a DN shard. It // is internally used by HAKeeper to maintain how many DNs available in // the system. @@ -373,41 +401,104 @@ func (m *LogStore) GetShards() []LogShard { return nil } +// CNStore cn store metadata +type CNStore struct { + // UUID CNStore uuid id + UUID string `protobuf:"bytes,1,opt,name=UUID,proto3" json:"UUID,omitempty"` + // Role CN role + Role CNRole `protobuf:"varint,2,opt,name=Role,proto3,enum=metadata.CNRole" json:"Role,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CNStore) Reset() { *m = CNStore{} } +func (m *CNStore) String() string { return proto.CompactTextString(m) } +func (*CNStore) ProtoMessage() {} +func (*CNStore) Descriptor() ([]byte, []int) { + return fileDescriptor_56d9f74966f40d04, []int{6} +} +func (m *CNStore) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CNStore) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CNStore.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *CNStore) XXX_Merge(src proto.Message) { + xxx_messageInfo_CNStore.Merge(m, src) +} +func (m *CNStore) XXX_Size() int { + return m.Size() +} +func (m *CNStore) XXX_DiscardUnknown() { + xxx_messageInfo_CNStore.DiscardUnknown(m) +} + +var xxx_messageInfo_CNStore proto.InternalMessageInfo + +func (m *CNStore) GetUUID() string { + if m != nil { + return m.UUID + } + return "" +} + +func (m *CNStore) GetRole() CNRole { + if m != nil { + return m.Role + } + return CNRole_TP +} + func init() { + proto.RegisterEnum("metadata.CNRole", CNRole_name, CNRole_value) proto.RegisterType((*DNShardRecord)(nil), "metadata.DNShardRecord") proto.RegisterType((*DNShard)(nil), "metadata.DNShard") proto.RegisterType((*LogShardRecord)(nil), "metadata.LogShardRecord") proto.RegisterType((*LogShard)(nil), "metadata.LogShard") proto.RegisterType((*DNStore)(nil), "metadata.DNStore") proto.RegisterType((*LogStore)(nil), "metadata.LogStore") + proto.RegisterType((*CNStore)(nil), "metadata.CNStore") } func init() { proto.RegisterFile("metadata.proto", fileDescriptor_56d9f74966f40d04) } var fileDescriptor_56d9f74966f40d04 = []byte{ - // 347 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xdf, 0x4a, 0x02, 0x41, - 0x14, 0xc6, 0x9b, 0x14, 0xff, 0x1c, 0x49, 0x6a, 0x6e, 0x5a, 0x22, 0x56, 0xd9, 0x2b, 0x09, 0x72, - 0xcb, 0x1e, 0x20, 0x12, 0x21, 0x8c, 0xb0, 0x98, 0xb0, 0x8b, 0xee, 0x66, 0xdd, 0x71, 0x5c, 0x6a, - 0x9d, 0x65, 0x1c, 0xa1, 0x67, 0xe8, 0xc9, 0xbc, 0xf4, 0x09, 0x24, 0x7c, 0x92, 0x70, 0x9c, 0xf1, - 0xcf, 0x2e, 0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 0x56, 0x09, 0xc9, 0x30, 0x86, 0x7c, 0xbf, - 0x6f, 0x32, 0x94, 0x89, 0x3e, 0x63, 0x1f, 0x0a, 0x9a, 0xb5, 0xb2, 0x9d, 0x6b, 0x54, 0x5a, 0x27, - 0x99, 0x6f, 0x6e, 0xe7, 0x57, 0x93, 0x89, 0xb9, 0xe6, 0x3d, 0xaf, 0x53, 0xfc, 0x0a, 0xbc, 0x4a, - 0x01, 0x71, 0x36, 0xd1, 0x3e, 0xb1, 0x7d, 0x3b, 0x5b, 0xba, 0x68, 0xbe, 0x74, 0xd1, 0xf7, 0xd2, - 0x45, 0x6f, 0xd7, 0x3b, 0x4b, 0x18, 0x53, 0x25, 0xa3, 0x4f, 0x21, 0x23, 0x1e, 0x8d, 0xad, 0x18, - 0x33, 0x3f, 0x79, 0xe7, 0x7e, 0x12, 0xf8, 0x96, 0x1b, 0x14, 0xf4, 0x3e, 0xde, 0xfc, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x2d, 0x13, 0xf1, 0xfd, 0xda, 0x02, 0x00, 0x00, + // 390 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0xdf, 0x6a, 0xe2, 0x40, + 0x14, 0xc6, 0x1d, 0x0d, 0x51, 0x8f, 0xac, 0x64, 0xe7, 0x66, 0xc3, 0xb2, 0x44, 0x09, 0x7b, 0x21, + 0xc2, 0x9a, 0xad, 0x7d, 0x80, 0xe2, 0x1f, 0x28, 0x96, 0x92, 0xca, 0xb4, 0xf6, 0xa2, 0x77, 0x89, + 0x19, 0x63, 0xa8, 0x71, 0xc2, 0x18, 0xa1, 0xcf, 0xd0, 0x27, 0xf3, 0xd2, 0x27, 0x90, 0xe2, 0x93, + 0x94, 0x8c, 0x19, 0xff, 0x44, 0x6a, 0xaf, 0x32, 0xdf, 0x39, 0x93, 0xdf, 0xf9, 0xbe, 0xe1, 0x40, + 0x35, 0xa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xcd, 0x50, 0x26, 0xe2, 0x8c, 0x2d, 0x50, 0x05, 0x2b, 0xb1, + 0x5d, 0x68, 0x54, 0xda, 0x3f, 0xcf, 0x9e, 0xb9, 0xab, 0x24, 0x93, 0x49, 0x7a, 0xcd, 0x1c, 0xee, + 0x52, 0x7c, 0x09, 0xfc, 0x9f, 0x01, 0xe2, 0xf3, 0x44, 0x19, 0x62, 0x0f, 0x8a, 0xbd, 0x0b, 0x0e, + 0xff, 0x82, 0x42, 0xd8, 0x8c, 0x8a, 0x64, 0xd5, 0xb6, 0x76, 0xc0, 0xf5, 0xec, 0xa4, 0x4e, 0x44, + 0xb7, 0xa9, 0x83, 0xba, 0xd3, 0x58, 0x85, 0xfc, 0xd3, 0x50, 0xcb, 0x25, 0xdf, 0xce, 0x50, 0x43, + 0xdd, 0x9b, 0xd5, 0xd6, 0x40, 0xeb, 0xad, 0x81, 0x3e, 0xb6, 0x06, 0x7a, 0xb9, 0x3a, 0xda, 0xf1, + 0xd0, 0x89, 0x79, 0xf0, 0xc6, 0x78, 0xe0, 0x07, 0x73, 0x29, 0xe6, 0xd4, 0x8a, 0x5e, 0x7d, 0x2b, + 0x72, 0x2d, 0x39, 0xc7, 0x55, 0xc5, 0xba, 0x5f, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x73, 0x05, + 0xd9, 0x15, 0x39, 0x03, 0x00, 0x00, } func (m *DNShardRecord) Marshal() (dAtA []byte, err error) { @@ -671,6 +762,45 @@ func (m *LogStore) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *CNStore) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *CNStore) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CNStore) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if m.Role != 0 { + i = encodeVarintMetadata(dAtA, i, uint64(m.Role)) + i-- + dAtA[i] = 0x10 + } + if len(m.UUID) > 0 { + i -= len(m.UUID) + copy(dAtA[i:], m.UUID) + i = encodeVarintMetadata(dAtA, i, uint64(len(m.UUID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintMetadata(dAtA []byte, offset int, v uint64) int { offset -= sovMetadata(v) base := offset @@ -800,6 +930,25 @@ func (m *LogStore) Size() (n int) { return n } +func (m *CNStore) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UUID) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + if m.Role != 0 { + n += 1 + sovMetadata(uint64(m.Role)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + func sovMetadata(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1456,6 +1605,108 @@ func (m *LogStore) Unmarshal(dAtA []byte) error { } return nil } +func (m *CNStore) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: CNStore: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CNStore: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UUID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UUID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Role", wireType) + } + m.Role = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Role |= CNRole(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipMetadata(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMetadata + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipMetadata(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/proto/metadata.proto b/proto/metadata.proto index daa46ce7835f0a897f7435b1e4cc6bd58b6adad7..941383d09e87954df4840cb5d32b5f186970caef 100644 --- a/proto/metadata.proto +++ b/proto/metadata.proto @@ -75,3 +75,19 @@ message LogStore { // Shards is for Log shards metadata. repeated LogShard Shards = 2 [(gogoproto.nullable) = false]; } + +// CNRole cn node role +enum CNRole { + // TP tp node + TP = 0; + // AP ap node + AP = 1; +} + +// CNStore cn store metadata +message CNStore { + // UUID CNStore uuid id + string UUID = 1; + // Role CN role + CNRole Role = 2; +} \ No newline at end of file