diff --git a/pkg/pb/metadata/metadata.pb.go b/pkg/pb/metadata/metadata.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..03d7a463377036cc98e666d03be8d76afb7cd7e7 --- /dev/null +++ b/pkg/pb/metadata/metadata.pb.go @@ -0,0 +1,576 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: metadata.proto + +package metadata + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package + +// DN dn node metadata +type DN struct { + // ID the id of the DN. The ID is not modified after the DN is created. + ID uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // ReplicaID only one replica for one DN. The ReplicaID is specified at + // the time the DN is created. DN restart ReplicaID will not change, when + // a DN is migrated to another node, the ReplicaID will be reset. + ReplicaID uint64 `protobuf:"varint,2,opt,name=replicaID,proto3" json:"replicaID,omitempty"` + // LogShardID a DN corresponds to a unique Shard of LogService. + LogShardID uint64 `protobuf:"varint,3,opt,name=logShardID,proto3" json:"logShardID,omitempty"` + // Start A DN manages data within a range [Start, end) + Start []byte `protobuf:"bytes,4,opt,name=start,proto3" json:"start,omitempty"` + // End A DN manages data within a range [Start, end) + End []byte `protobuf:"bytes,5,opt,name=end,proto3" json:"end,omitempty"` + // Address DN external service address. + Address string `protobuf:"bytes,6,opt,name=address,proto3" json:"address,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DN) Reset() { *m = DN{} } +func (m *DN) String() string { return proto.CompactTextString(m) } +func (*DN) ProtoMessage() {} +func (*DN) Descriptor() ([]byte, []int) { + return fileDescriptor_56d9f74966f40d04, []int{0} +} +func (m *DN) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DN) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DN.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DN) XXX_Merge(src proto.Message) { + xxx_messageInfo_DN.Merge(m, src) +} +func (m *DN) XXX_Size() int { + return m.Size() +} +func (m *DN) XXX_DiscardUnknown() { + xxx_messageInfo_DN.DiscardUnknown(m) +} + +var xxx_messageInfo_DN proto.InternalMessageInfo + +func (m *DN) GetID() uint64 { + if m != nil { + return m.ID + } + return 0 +} + +func (m *DN) GetReplicaID() uint64 { + if m != nil { + return m.ReplicaID + } + return 0 +} + +func (m *DN) GetLogShardID() uint64 { + if m != nil { + return m.LogShardID + } + return 0 +} + +func (m *DN) GetStart() []byte { + if m != nil { + return m.Start + } + return nil +} + +func (m *DN) GetEnd() []byte { + if m != nil { + return m.End + } + return nil +} + +func (m *DN) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func init() { + proto.RegisterType((*DN)(nil), "metadata.DN") +} + +func init() { proto.RegisterFile("metadata.proto", fileDescriptor_56d9f74966f40d04) } + +var fileDescriptor_56d9f74966f40d04 = []byte{ + // 245 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x90, 0x41, 0x4a, 0xc4, 0x30, + 0x14, 0x86, 0x79, 0x99, 0x99, 0xea, 0x3c, 0x44, 0x24, 0x88, 0x04, 0x91, 0x5a, 0x5c, 0x75, 0xe3, + 0x04, 0xf1, 0x00, 0xc2, 0xd0, 0x4d, 0x37, 0x2e, 0xea, 0xce, 0xdd, 0xeb, 0x24, 0x66, 0x82, 0xd3, + 0xa6, 0xa4, 0x19, 0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 0x00, 0x00, 0xff, 0xff, 0xf4, 0xf5, 0x5c, + 0xb9, 0x31, 0x01, 0x00, 0x00, +} + +func (m *DN) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DN) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.ID != 0 { + dAtA[i] = 0x8 + i++ + i = encodeVarintMetadata(dAtA, i, uint64(m.ID)) + } + if m.ReplicaID != 0 { + dAtA[i] = 0x10 + i++ + i = encodeVarintMetadata(dAtA, i, uint64(m.ReplicaID)) + } + if m.LogShardID != 0 { + dAtA[i] = 0x18 + i++ + i = encodeVarintMetadata(dAtA, i, uint64(m.LogShardID)) + } + if len(m.Start) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Start))) + i += copy(dAtA[i:], m.Start) + } + if len(m.End) > 0 { + dAtA[i] = 0x2a + i++ + i = encodeVarintMetadata(dAtA, i, uint64(len(m.End))) + i += copy(dAtA[i:], m.End) + } + if len(m.Address) > 0 { + dAtA[i] = 0x32 + i++ + i = encodeVarintMetadata(dAtA, i, uint64(len(m.Address))) + i += copy(dAtA[i:], m.Address) + } + if m.XXX_unrecognized != nil { + i += copy(dAtA[i:], m.XXX_unrecognized) + } + return i, nil +} + +func encodeVarintMetadata(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *DN) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ID != 0 { + n += 1 + sovMetadata(uint64(m.ID)) + } + if m.ReplicaID != 0 { + n += 1 + sovMetadata(uint64(m.ReplicaID)) + } + if m.LogShardID != 0 { + n += 1 + sovMetadata(uint64(m.LogShardID)) + } + l = len(m.Start) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.End) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + l = len(m.Address) + if l > 0 { + n += 1 + l + sovMetadata(uint64(l)) + } + if m.XXX_unrecognized != nil { + n += len(m.XXX_unrecognized) + } + return n +} + +func sovMetadata(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozMetadata(x uint64) (n int) { + return sovMetadata(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *DN) 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: DN: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DN: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + m.ID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReplicaID", wireType) + } + m.ReplicaID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ReplicaID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LogShardID", wireType) + } + m.LogShardID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LogShardID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Start", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Start = append(m.Start[:0], dAtA[iNdEx:postIndex]...) + if m.Start == nil { + m.Start = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field End", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthMetadata + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMetadata + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.End = append(m.End[:0], dAtA[iNdEx:postIndex]...) + if m.End == nil { + m.End = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMetadata(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthMetadata + } + if (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 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthMetadata + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthMetadata + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowMetadata + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipMetadata(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthMetadata + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthMetadata = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMetadata = fmt.Errorf("proto: integer overflow") +) diff --git a/proto/metadata.proto b/proto/metadata.proto new file mode 100644 index 0000000000000000000000000000000000000000..ae6a01b149d7451f1b021e1c168039fb2203cd0b --- /dev/null +++ b/proto/metadata.proto @@ -0,0 +1,36 @@ +// Copyright 2022 MatrixOrigin. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; +package metadata; +option go_package = "github.com/matrixorigin/matrixone/pkg/pb/metadata"; + +import "github.com/gogo/protobuf/gogoproto/gogo.proto"; + +// DN dn shard metadata +message DN { + // ID the id of the DN. The ID is not modified after the DN is created. + uint64 id = 1 [(gogoproto.customname) = "ID"]; + // ReplicaID only one replica for one DN. The ReplicaID is specified at + // the time the DN is created. DN restart ReplicaID will not change, when + // a DN is migrated to another node, the ReplicaID will be reset. + uint64 replicaID = 2; + // LogShardID a DN corresponds to a unique Shard of LogService. + uint64 logShardID = 3; + // Start A DN manages data within a range [Start, end) + bytes start = 4; + // End A DN manages data within a range [Start, end) + bytes end = 5; + // Address DN external service address. + string address = 6; +}