From 11e628c69c29a9d686d3a7c2196f81b93e0c08d8 Mon Sep 17 00:00:00 2001 From: Jordan Halterman Date: Wed, 20 Jul 2022 00:19:01 -0700 Subject: [PATCH] Fix compiler errors in API --- api/atomix/gossip/v1/config.pb.go | 76 ++++-- api/atomix/gossip/v1/config.proto | 4 +- api/atomix/gossip/v1/protocol.go | 23 ++ api/atomix/gossip/v1/protocol.pb.go | 370 ++++++++++++++++++++++------ api/atomix/gossip/v1/protocol.proto | 9 +- 5 files changed, 383 insertions(+), 99 deletions(-) create mode 100644 api/atomix/gossip/v1/protocol.go diff --git a/api/atomix/gossip/v1/config.pb.go b/api/atomix/gossip/v1/config.pb.go index 7c149e5..58cd907 100644 --- a/api/atomix/gossip/v1/config.pb.go +++ b/api/atomix/gossip/v1/config.pb.go @@ -132,7 +132,7 @@ func (m *ClusterConfig) GetGroups() []PeerGroupConfig { } type ReplicaConfig struct { - ReplicaID ReplicaID `protobuf:"varint,1,opt,name=replica_id,json=replicaId,proto3,casttype=ReplicaID" json:"replica_id,omitempty"` + ReplicaID ReplicaID `protobuf:"bytes,1,opt,name=replica_id,json=replicaId,proto3,casttype=ReplicaID" json:"replica_id,omitempty"` Host string `protobuf:"bytes,2,opt,name=host,proto3" json:"host,omitempty"` Port int32 `protobuf:"varint,3,opt,name=port,proto3" json:"port,omitempty"` } @@ -174,7 +174,7 @@ func (m *ReplicaConfig) GetReplicaID() ReplicaID { if m != nil { return m.ReplicaID } - return 0 + return "" } func (m *ReplicaConfig) GetHost() string { @@ -244,7 +244,7 @@ func (m *PeerGroupConfig) GetPeers() []PeerConfig { } type PeerConfig struct { - PeerID PeerID `protobuf:"varint,1,opt,name=peer_id,json=peerId,proto3,casttype=PeerID" json:"peer_id,omitempty"` + PeerID PeerID `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3,casttype=PeerID" json:"peer_id,omitempty"` } func (m *PeerConfig) Reset() { *m = PeerConfig{} } @@ -284,7 +284,7 @@ func (m *PeerConfig) GetPeerID() PeerID { if m != nil { return m.PeerID } - return 0 + return "" } func init() { @@ -317,7 +317,7 @@ var fileDescriptor_7fc2fc0c73445944 = []byte{ 0xdd, 0x0e, 0x85, 0x32, 0xaf, 0xf0, 0x96, 0xa4, 0x7d, 0x55, 0x86, 0x2d, 0xb6, 0xb6, 0xe1, 0xb7, 0xd0, 0xc9, 0xb5, 0x5c, 0xaa, 0x22, 0xd8, 0x71, 0x80, 0xe7, 0xff, 0x02, 0x4e, 0x39, 0xd7, 0x27, 0x56, 0xb3, 0x81, 0xa8, 0x6d, 0x91, 0x86, 0xc1, 0xc6, 0x06, 0xfc, 0x1a, 0xa0, 0xa6, 0xcf, 0x84, - 0x8f, 0xae, 0x9d, 0x0c, 0xab, 0x32, 0xec, 0xd6, 0xb2, 0xe9, 0xe4, 0xcf, 0xed, 0x07, 0xeb, 0xd6, + 0x8f, 0xae, 0x9b, 0x0c, 0xab, 0x32, 0xec, 0xd6, 0xb2, 0xe9, 0xe4, 0xcf, 0xed, 0x07, 0xeb, 0xd6, 0xea, 0x69, 0x86, 0x31, 0xb4, 0x3f, 0xc8, 0xc2, 0xb8, 0x8c, 0xba, 0xcc, 0xd5, 0xb6, 0xa7, 0xa4, 0x36, 0xc1, 0xee, 0x08, 0x8d, 0xf7, 0x98, 0xab, 0xa3, 0x2f, 0x08, 0x1e, 0x6c, 0x5d, 0x85, 0x8f, 0xa0, 0xaf, 0x52, 0x6d, 0x84, 0xcd, 0xb0, 0x59, 0x3c, 0x48, 0x48, 0x55, 0x86, 0xbd, 0xb5, 0xd4, @@ -326,7 +326,7 @@ var fileDescriptor_7fc2fc0c73445944 = []byte{ 0xb6, 0x6f, 0x3e, 0x7f, 0xbf, 0x2a, 0xc3, 0x8e, 0x15, 0xb8, 0x03, 0xea, 0x8a, 0x75, 0xac, 0x68, 0x9a, 0x25, 0xc1, 0x55, 0x45, 0xd0, 0x75, 0x45, 0xd0, 0xef, 0x8a, 0xa0, 0xaf, 0x2b, 0xd2, 0xba, 0x5e, 0x91, 0xd6, 0xcf, 0x15, 0x69, 0x9d, 0x75, 0xdc, 0xdf, 0xf1, 0xf2, 0x6f, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xfa, 0xe1, 0x57, 0x51, 0x09, 0x03, 0x00, 0x00, + 0xff, 0xff, 0x6d, 0x5c, 0xd9, 0x23, 0x09, 0x03, 0x00, 0x00, } func (m *GossipConfig) Marshal() (dAtA []byte, err error) { @@ -455,10 +455,12 @@ func (m *ReplicaConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if m.ReplicaID != 0 { - i = encodeVarintConfig(dAtA, i, uint64(m.ReplicaID)) + if len(m.ReplicaID) > 0 { + i -= len(m.ReplicaID) + copy(dAtA[i:], m.ReplicaID) + i = encodeVarintConfig(dAtA, i, uint64(len(m.ReplicaID))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -525,10 +527,12 @@ func (m *PeerConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PeerID != 0 { - i = encodeVarintConfig(dAtA, i, uint64(m.PeerID)) + if len(m.PeerID) > 0 { + i -= len(m.PeerID) + copy(dAtA[i:], m.PeerID) + i = encodeVarintConfig(dAtA, i, uint64(len(m.PeerID))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -588,8 +592,9 @@ func (m *ReplicaConfig) Size() (n int) { } var l int _ = l - if m.ReplicaID != 0 { - n += 1 + sovConfig(uint64(m.ReplicaID)) + l = len(m.ReplicaID) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) } l = len(m.Host) if l > 0 { @@ -625,8 +630,9 @@ func (m *PeerConfig) Size() (n int) { } var l int _ = l - if m.PeerID != 0 { - n += 1 + sovConfig(uint64(m.PeerID)) + l = len(m.PeerID) + if l > 0 { + n += 1 + l + sovConfig(uint64(l)) } return n } @@ -907,10 +913,10 @@ func (m *ReplicaConfig) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ReplicaID", wireType) } - m.ReplicaID = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowConfig @@ -920,11 +926,24 @@ func (m *ReplicaConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ReplicaID |= ReplicaID(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthConfig + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConfig + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ReplicaID = ReplicaID(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Host", wireType) @@ -1130,10 +1149,10 @@ func (m *PeerConfig) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { + if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PeerID", wireType) } - m.PeerID = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowConfig @@ -1143,11 +1162,24 @@ func (m *PeerConfig) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.PeerID |= PeerID(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthConfig + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthConfig + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerID = PeerID(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipConfig(dAtA[iNdEx:]) diff --git a/api/atomix/gossip/v1/config.proto b/api/atomix/gossip/v1/config.proto index 316a52d..45f5fa0 100644 --- a/api/atomix/gossip/v1/config.proto +++ b/api/atomix/gossip/v1/config.proto @@ -30,7 +30,7 @@ message ClusterConfig { } message ReplicaConfig { - uint64 replica_id = 1 [ + string replica_id = 1 [ (gogoproto.customname) = "ReplicaID", (gogoproto.casttype) = "ReplicaID" ]; @@ -49,7 +49,7 @@ message PeerGroupConfig { } message PeerConfig { - uint64 peer_id = 1 [ + string peer_id = 1 [ (gogoproto.customname) = "PeerID", (gogoproto.casttype) = "PeerID" ]; diff --git a/api/atomix/gossip/v1/protocol.go b/api/atomix/gossip/v1/protocol.go new file mode 100644 index 0000000..ef5e08b --- /dev/null +++ b/api/atomix/gossip/v1/protocol.go @@ -0,0 +1,23 @@ +// SPDX-FileCopyrightText: 2022-present Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 + +package v1 + +import "time" + +type PartitionID uint64 + +type ReplicaID string + +type MemberID string + +type PeerID MemberID + +type PeerGroupID uint64 + +type LogicalTime uint64 + +type Epoch uint64 + +type PhysicalTime = time.Time diff --git a/api/atomix/gossip/v1/protocol.pb.go b/api/atomix/gossip/v1/protocol.pb.go index 1b4a164..c99b9c6 100644 --- a/api/atomix/gossip/v1/protocol.pb.go +++ b/api/atomix/gossip/v1/protocol.pb.go @@ -28,8 +28,60 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +type PrimitiveType struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` +} + +func (m *PrimitiveType) Reset() { *m = PrimitiveType{} } +func (m *PrimitiveType) String() string { return proto.CompactTextString(m) } +func (*PrimitiveType) ProtoMessage() {} +func (*PrimitiveType) Descriptor() ([]byte, []int) { + return fileDescriptor_8208620e92773234, []int{0} +} +func (m *PrimitiveType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PrimitiveType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PrimitiveType.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 *PrimitiveType) XXX_Merge(src proto.Message) { + xxx_messageInfo_PrimitiveType.Merge(m, src) +} +func (m *PrimitiveType) XXX_Size() int { + return m.Size() +} +func (m *PrimitiveType) XXX_DiscardUnknown() { + xxx_messageInfo_PrimitiveType.DiscardUnknown(m) +} + +var xxx_messageInfo_PrimitiveType proto.InternalMessageInfo + +func (m *PrimitiveType) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *PrimitiveType) GetVersion() string { + if m != nil { + return m.Version + } + return "" +} + type PrimitiveId struct { - Type PrimitiveType `protobuf:"bytes,1,opt,name=type,proto3,casttype=PrimitiveType" json:"type,omitempty"` + Type PrimitiveType `protobuf:"bytes,1,opt,name=type,proto3" json:"type"` Cluster string `protobuf:"bytes,2,opt,name=cluster,proto3" json:"cluster,omitempty"` Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` } @@ -38,7 +90,7 @@ func (m *PrimitiveId) Reset() { *m = PrimitiveId{} } func (m *PrimitiveId) String() string { return proto.CompactTextString(m) } func (*PrimitiveId) ProtoMessage() {} func (*PrimitiveId) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{0} + return fileDescriptor_8208620e92773234, []int{1} } func (m *PrimitiveId) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -71,7 +123,7 @@ func (m *PrimitiveId) GetType() PrimitiveType { if m != nil { return m.Type } - return "" + return PrimitiveType{} } func (m *PrimitiveId) GetCluster() string { @@ -99,7 +151,7 @@ func (m *RequestHeader) Reset() { *m = RequestHeader{} } func (m *RequestHeader) String() string { return proto.CompactTextString(m) } func (*RequestHeader) ProtoMessage() {} func (*RequestHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{1} + return fileDescriptor_8208620e92773234, []int{2} } func (m *RequestHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -164,7 +216,7 @@ func (m *ResponseHeader) Reset() { *m = ResponseHeader{} } func (m *ResponseHeader) String() string { return proto.CompactTextString(m) } func (*ResponseHeader) ProtoMessage() {} func (*ResponseHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{2} + return fileDescriptor_8208620e92773234, []int{3} } func (m *ResponseHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -208,7 +260,7 @@ func (m *ReadAllRequest) Reset() { *m = ReadAllRequest{} } func (m *ReadAllRequest) String() string { return proto.CompactTextString(m) } func (*ReadAllRequest) ProtoMessage() {} func (*ReadAllRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{3} + return fileDescriptor_8208620e92773234, []int{4} } func (m *ReadAllRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -253,7 +305,7 @@ func (m *ReadAllResponse) Reset() { *m = ReadAllResponse{} } func (m *ReadAllResponse) String() string { return proto.CompactTextString(m) } func (*ReadAllResponse) ProtoMessage() {} func (*ReadAllResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{4} + return fileDescriptor_8208620e92773234, []int{5} } func (m *ReadAllResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -306,7 +358,7 @@ func (m *ReadRequest) Reset() { *m = ReadRequest{} } func (m *ReadRequest) String() string { return proto.CompactTextString(m) } func (*ReadRequest) ProtoMessage() {} func (*ReadRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{5} + return fileDescriptor_8208620e92773234, []int{6} } func (m *ReadRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -365,7 +417,7 @@ func (m *ReadResponse) Reset() { *m = ReadResponse{} } func (m *ReadResponse) String() string { return proto.CompactTextString(m) } func (*ReadResponse) ProtoMessage() {} func (*ReadResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{6} + return fileDescriptor_8208620e92773234, []int{7} } func (m *ReadResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -418,7 +470,7 @@ func (m *Object) Reset() { *m = Object{} } func (m *Object) String() string { return proto.CompactTextString(m) } func (*Object) ProtoMessage() {} func (*Object) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{7} + return fileDescriptor_8208620e92773234, []int{8} } func (m *Object) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -480,7 +532,7 @@ func (m *GossipMessage) Reset() { *m = GossipMessage{} } func (m *GossipMessage) String() string { return proto.CompactTextString(m) } func (*GossipMessage) ProtoMessage() {} func (*GossipMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{8} + return fileDescriptor_8208620e92773234, []int{9} } func (m *GossipMessage) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -574,7 +626,7 @@ func (m *GossipHeader) Reset() { *m = GossipHeader{} } func (m *GossipHeader) String() string { return proto.CompactTextString(m) } func (*GossipHeader) ProtoMessage() {} func (*GossipHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{9} + return fileDescriptor_8208620e92773234, []int{10} } func (m *GossipHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -618,7 +670,7 @@ func (m *Initialize) Reset() { *m = Initialize{} } func (m *Initialize) String() string { return proto.CompactTextString(m) } func (*Initialize) ProtoMessage() {} func (*Initialize) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{10} + return fileDescriptor_8208620e92773234, []int{11} } func (m *Initialize) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -664,7 +716,7 @@ func (m *Advertise) Reset() { *m = Advertise{} } func (m *Advertise) String() string { return proto.CompactTextString(m) } func (*Advertise) ProtoMessage() {} func (*Advertise) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{11} + return fileDescriptor_8208620e92773234, []int{12} } func (m *Advertise) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -723,7 +775,7 @@ func (m *Update) Reset() { *m = Update{} } func (m *Update) String() string { return proto.CompactTextString(m) } func (*Update) ProtoMessage() {} func (*Update) Descriptor() ([]byte, []int) { - return fileDescriptor_8208620e92773234, []int{12} + return fileDescriptor_8208620e92773234, []int{13} } func (m *Update) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -767,6 +819,7 @@ func (m *Update) GetObject() Object { } func init() { + proto.RegisterType((*PrimitiveType)(nil), "atomix.gossip.v1.PrimitiveType") proto.RegisterType((*PrimitiveId)(nil), "atomix.gossip.v1.PrimitiveId") proto.RegisterType((*RequestHeader)(nil), "atomix.gossip.v1.RequestHeader") proto.RegisterType((*ResponseHeader)(nil), "atomix.gossip.v1.ResponseHeader") @@ -785,51 +838,52 @@ func init() { func init() { proto.RegisterFile("atomix/gossip/v1/protocol.proto", fileDescriptor_8208620e92773234) } var fileDescriptor_8208620e92773234 = []byte{ - // 703 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x55, 0x4d, 0x6f, 0xd3, 0x4a, - 0x14, 0xf5, 0xa4, 0x79, 0x6e, 0x73, 0x93, 0xbc, 0xd7, 0x37, 0xaf, 0x0b, 0x2b, 0x8f, 0xda, 0xc5, - 0x12, 0x52, 0x57, 0x49, 0x5b, 0x04, 0x1b, 0xbe, 0x54, 0x0b, 0x44, 0x22, 0x54, 0x5a, 0xac, 0x76, - 0x8d, 0x9c, 0x7a, 0x08, 0x03, 0x76, 0xec, 0xda, 0x93, 0x88, 0xb2, 0x40, 0x6c, 0xd9, 0xf1, 0x03, - 0x90, 0x10, 0xff, 0xa6, 0x12, 0x9b, 0x2e, 0x59, 0x45, 0x28, 0xfd, 0x05, 0x6c, 0xbb, 0x42, 0xf3, - 0x61, 0x37, 0x69, 0x52, 0x3e, 0xda, 0xb2, 0x1b, 0xdf, 0x39, 0xf7, 0xcc, 0x39, 0x67, 0x72, 0x27, - 0x60, 0x79, 0x2c, 0x0a, 0xe9, 0xab, 0x46, 0x27, 0x4a, 0x53, 0x1a, 0x37, 0xfa, 0xab, 0x8d, 0x38, - 0x89, 0x58, 0xb4, 0x1b, 0x05, 0x75, 0xb1, 0xc0, 0xf3, 0x12, 0x50, 0x97, 0x80, 0x7a, 0x7f, 0xb5, - 0x66, 0x76, 0xa2, 0xa8, 0x13, 0x10, 0x09, 0x6c, 0xf7, 0x9e, 0x35, 0xfc, 0x5e, 0xe2, 0x31, 0x1a, - 0x75, 0x65, 0x47, 0x6d, 0x69, 0x82, 0x92, 0xd1, 0x90, 0xa4, 0xcc, 0x0b, 0x63, 0x85, 0x58, 0xe8, - 0x44, 0x9d, 0x48, 0x2c, 0x1b, 0x7c, 0x25, 0xab, 0x76, 0x1b, 0xca, 0x5b, 0x09, 0x0d, 0x29, 0xa3, - 0x7d, 0xd2, 0xf2, 0xf1, 0x35, 0x28, 0xb2, 0xfd, 0x98, 0x18, 0x68, 0x09, 0x2d, 0x97, 0x9c, 0x7f, - 0x8f, 0x07, 0x56, 0x35, 0xdf, 0xde, 0xde, 0x8f, 0x89, 0x2b, 0xb6, 0xb1, 0x01, 0xb3, 0xbb, 0x41, - 0x2f, 0x65, 0x24, 0x31, 0x0a, 0x1c, 0xe9, 0x66, 0x9f, 0x18, 0x43, 0xb1, 0xeb, 0x85, 0xc4, 0x98, - 0x11, 0x65, 0xb1, 0xb6, 0x3f, 0x15, 0xa0, 0xea, 0x92, 0xbd, 0x1e, 0x49, 0x59, 0x93, 0x78, 0x3e, - 0x49, 0xf0, 0x3a, 0x54, 0x62, 0x2f, 0x61, 0x94, 0x1b, 0x78, 0x4a, 0x7d, 0x71, 0x5c, 0xd5, 0x31, - 0x87, 0x03, 0xab, 0xbc, 0x95, 0xd5, 0x5b, 0xf7, 0x8f, 0xc7, 0x3f, 0xdd, 0x72, 0xde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80, 0x22, 0x2f, 0xe2, 0xc5, 0xe9, 0xe0, - 0x8c, 0xcb, 0x3c, 0x6b, 0x5b, 0xbd, 0x09, 0x8f, 0x73, 0x89, 0xd6, 0x59, 0x99, 0xa8, 0x39, 0xaa, - 0xfd, 0x0c, 0xb0, 0x8c, 0x56, 0x90, 0x63, 0x1c, 0x0c, 0x4d, 0x74, 0x38, 0x34, 0xd1, 0xd7, 0xa1, - 0x89, 0xde, 0x1f, 0x99, 0xda, 0xe1, 0x91, 0xa9, 0x7d, 0x39, 0x32, 0xb5, 0xb6, 0x2e, 0xfe, 0xef, - 0xaf, 0x7f, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x9f, 0x10, 0x9b, 0x7c, 0x08, 0x00, 0x00, + // 718 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xc1, 0x6f, 0xd3, 0x3e, + 0x18, 0x8d, 0xbb, 0xfe, 0xb2, 0xf5, 0x6b, 0xfb, 0x63, 0x32, 0x3b, 0x44, 0x85, 0xa5, 0x23, 0xa7, + 0x9d, 0xda, 0x6d, 0x08, 0x24, 0x04, 0x03, 0xad, 0x02, 0xd1, 0x0a, 0x8d, 0x8d, 0x68, 0x3b, 0xa3, + 0x74, 0x31, 0xc5, 0x90, 0xd4, 0x59, 0xe2, 0x46, 0x8c, 0x03, 0xe2, 0xca, 0x8d, 0x3f, 0x00, 0x09, + 0xf1, 0xdf, 0x4c, 0xe2, 0xb2, 0x23, 0xa7, 0x09, 0x75, 0x7f, 0x01, 0x57, 0x4e, 0x28, 0xb6, 0x93, + 0xb6, 0x6b, 0x3b, 0x60, 0x1b, 0x37, 0xfb, 0xcb, 0xfb, 0x9e, 0xdf, 0x7b, 0xee, 0x67, 0x15, 0xaa, + 0x0e, 0x67, 0x3e, 0x7d, 0x53, 0xef, 0xb0, 0x28, 0xa2, 0x41, 0x3d, 0x5e, 0xad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 0xda, 0x67, 0xf5, 0x26, 0x3c, 0xcd, 0x24, 0x56, 0xa7, 0x65, 0xa2, 0xe6, 0xa8, 0xf2, 0x3b, + 0xc0, 0x32, 0x5a, 0x41, 0x0d, 0xe3, 0xb0, 0x6f, 0xa2, 0xa3, 0xbe, 0x89, 0xbe, 0xf7, 0x4d, 0xf4, + 0xf1, 0xc4, 0xd4, 0x8e, 0x4e, 0x4c, 0xed, 0xdb, 0x89, 0xa9, 0xb5, 0x75, 0xf1, 0x17, 0xe2, 0xe6, + 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5d, 0xf8, 0x98, 0xb2, 0xcf, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1044,6 +1098,43 @@ var _Gossip_serviceDesc = grpc.ServiceDesc{ Metadata: "atomix/gossip/v1/protocol.proto", } +func (m *PrimitiveType) 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 *PrimitiveType) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PrimitiveType) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintProtocol(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintProtocol(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *PrimitiveId) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1078,13 +1169,16 @@ func (m *PrimitiveId) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.Type) > 0 { - i -= len(m.Type) - copy(dAtA[i:], m.Type) - i = encodeVarintProtocol(dAtA, i, uint64(len(m.Type))) - i-- - dAtA[i] = 0xa + { + size, err := m.Type.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintProtocol(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -1659,16 +1753,31 @@ func encodeVarintProtocol(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *PrimitiveId) Size() (n int) { +func (m *PrimitiveType) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Type) + l = len(m.Name) if l > 0 { n += 1 + l + sovProtocol(uint64(l)) } + l = len(m.Version) + if l > 0 { + n += 1 + l + sovProtocol(uint64(l)) + } + return n +} + +func (m *PrimitiveId) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Type.Size() + n += 1 + l + sovProtocol(uint64(l)) l = len(m.Cluster) if l > 0 { n += 1 + l + sovProtocol(uint64(l)) @@ -1892,7 +2001,7 @@ func sovProtocol(x uint64) (n int) { func sozProtocol(x uint64) (n int) { return sovProtocol(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *PrimitiveId) Unmarshal(dAtA []byte) error { +func (m *PrimitiveType) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1915,15 +2024,47 @@ func (m *PrimitiveId) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PrimitiveId: wiretype end group for non-group") + return fmt.Errorf("proto: PrimitiveType: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PrimitiveId: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PrimitiveType: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + 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 ErrInvalidLengthProtocol + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthProtocol + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1951,7 +2092,90 @@ func (m *PrimitiveId) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Type = PrimitiveType(dAtA[iNdEx:postIndex]) + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipProtocol(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthProtocol + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PrimitiveId) 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 ErrIntOverflowProtocol + } + 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: PrimitiveId: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PrimitiveId: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowProtocol + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthProtocol + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthProtocol + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Type.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 2: if wireType != 2 { diff --git a/api/atomix/gossip/v1/protocol.proto b/api/atomix/gossip/v1/protocol.proto index a375239..43a617f 100644 --- a/api/atomix/gossip/v1/protocol.proto +++ b/api/atomix/gossip/v1/protocol.proto @@ -18,9 +18,14 @@ service Gossip { rpc Gossip (stream GossipMessage) returns (stream GossipMessage); } +message PrimitiveType { + string name = 1; + string version = 2; +} + message PrimitiveId { - string type = 1 [ - (gogoproto.casttype) = "PrimitiveType" + PrimitiveType type = 1 [ + (gogoproto.nullable) = false ]; string cluster = 2; string name = 3;