From 5af26f4a46cdcb6c4ba54358bbec5cc6ec36495c Mon Sep 17 00:00:00 2001 From: liuxiaolong <736321739@qq.com> Date: 星期五, 14 二月 2020 14:30:13 +0800 Subject: [PATCH] add RuleMessage --- commsg.pb.go | 395 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 363 insertions(+), 32 deletions(-) diff --git a/commsg.pb.go b/commsg.pb.go index 2866693..3511ee2 100644 --- a/commsg.pb.go +++ b/commsg.pb.go @@ -8,6 +8,7 @@ proto "github.com/gogo/protobuf/proto" io "io" math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -150,10 +151,11 @@ } type SdkMessage struct { - Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` - Caddr string `protobuf:"bytes,2,opt,name=caddr,proto3" json:"caddr,omitempty"` - Tasklab *TaskLabel `protobuf:"bytes,3,opt,name=tasklab,proto3" json:"tasklab,omitempty"` - Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` + Caddr string `protobuf:"bytes,2,opt,name=caddr,proto3" json:"caddr,omitempty"` + Tasklab *TaskLabel `protobuf:"bytes,3,opt,name=tasklab,proto3" json:"tasklab,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + Push *PushAttach `protobuf:"bytes,5,opt,name=push,proto3" json:"push,omitempty"` } func (m *SdkMessage) Reset() { *m = SdkMessage{} } @@ -213,6 +215,13 @@ func (m *SdkMessage) GetData() []byte { if m != nil { return m.Data + } + return nil +} + +func (m *SdkMessage) GetPush() *PushAttach { + if m != nil { + return m.Push } return nil } @@ -277,37 +286,102 @@ return nil } +type RuleMessage struct { + Taskid string `protobuf:"bytes,1,opt,name=taskid,proto3" json:"taskid,omitempty"` + Taskname string `protobuf:"bytes,2,opt,name=taskname,proto3" json:"taskname,omitempty"` + Sdkmsg *SdkMessage `protobuf:"bytes,3,opt,name=sdkmsg,proto3" json:"sdkmsg,omitempty"` +} + +func (m *RuleMessage) Reset() { *m = RuleMessage{} } +func (m *RuleMessage) String() string { return proto.CompactTextString(m) } +func (*RuleMessage) ProtoMessage() {} +func (*RuleMessage) Descriptor() ([]byte, []int) { + return fileDescriptor_968fba5e415d8aac, []int{4} +} +func (m *RuleMessage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RuleMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RuleMessage.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 *RuleMessage) XXX_Merge(src proto.Message) { + xxx_messageInfo_RuleMessage.Merge(m, src) +} +func (m *RuleMessage) XXX_Size() int { + return m.Size() +} +func (m *RuleMessage) XXX_DiscardUnknown() { + xxx_messageInfo_RuleMessage.DiscardUnknown(m) +} + +var xxx_messageInfo_RuleMessage proto.InternalMessageInfo + +func (m *RuleMessage) GetTaskid() string { + if m != nil { + return m.Taskid + } + return "" +} + +func (m *RuleMessage) GetTaskname() string { + if m != nil { + return m.Taskname + } + return "" +} + +func (m *RuleMessage) GetSdkmsg() *SdkMessage { + if m != nil { + return m.Sdkmsg + } + return nil +} + func init() { proto.RegisterType((*SdkmsgWithTask)(nil), "protomsg.SdkmsgWithTask") proto.RegisterType((*TaskLabel)(nil), "protomsg.TaskLabel") proto.RegisterType((*SdkMessage)(nil), "protomsg.SdkMessage") proto.RegisterType((*Recvmsg)(nil), "protomsg.recvmsg") + proto.RegisterType((*RuleMessage)(nil), "protomsg.RuleMessage") } func init() { proto.RegisterFile("commsg.proto", fileDescriptor_968fba5e415d8aac) } var fileDescriptor_968fba5e415d8aac = []byte{ - // 315 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0x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0xaa, 0x21, 0x78, 0x03, 0x58, 0x73, 0x75, 0x2f, 0x8c, 0x61, 0x89, 0xc0, 0x27, - 0xe0, 0x1d, 0x66, 0xb4, 0xd2, 0xfe, 0x8a, 0x19, 0xe7, 0x79, 0x13, 0xa2, 0x06, 0x7c, 0x09, 0x63, - 0x9b, 0x66, 0xcb, 0x36, 0xc4, 0xf3, 0x51, 0x38, 0x5b, 0x9d, 0x1e, 0x02, 0x74, 0xb3, 0x45, 0x6d, - 0x0d, 0xc6, 0x30, 0x38, 0xda, 0x84, 0xd3, 0xc1, 0x2d, 0x8c, 0x73, 0x11, 0xbf, 0x6a, 0x93, 0xe0, - 0x05, 0xf4, 0xbb, 0xa6, 0x7d, 0xc9, 0x6d, 0xf9, 0x51, 0x4b, 0xa7, 0xed, 0x3e, 0x33, 0x19, 0x3b, - 0x17, 0xaf, 0xde, 0x67, 0x83, 0x37, 0xe4, 0xbb, 0xa4, 0x68, 0x5f, 0x52, 0xf4, 0x5b, 0x52, 0xf4, - 0x55, 0xd1, 0xde, 0xbe, 0xa2, 0xbd, 0x9f, 0x8a, 0xf6, 0x36, 0x23, 0x97, 0xe9, 0xea, 0x2f, 0x00, - 0x00, 0xff, 0xff, 0xc8, 0x63, 0xfd, 0xdb, 0xe6, 0x01, 0x00, 0x00, + // 374 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x50, 0x3d, 0x4e, 0xf3, 0x40, + 0x14, 0xcc, 0xc6, 0xf9, 0x7d, 0x89, 0xa2, 0x4f, 0xfb, 0x45, 0x9f, 0x56, 0x29, 0x2c, 0xcb, 0x95, + 0x8b, 0x8f, 0x14, 0x81, 0x0b, 0x40, 0x43, 0x03, 0x12, 0xda, 0x20, 0x21, 0xd1, 0x6d, 0xbc, 0xc6, + 0xb6, 0x1c, 0xc7, 0x56, 0x9e, 0x83, 0xe0, 0x0c, 0x34, 0x5c, 0x81, 0xdb, 0x50, 0xa6, 0xa4, 0x44, + 0xc9, 0x45, 0xd0, 0xae, 0xd7, 0x4e, 0xd2, 0x52, 0x79, 0xc6, 0xef, 0xbd, 0xd9, 0x99, 0x81, 0xa1, + 0x9f, 0xa5, 0x29, 0x86, 0xd3, 0x7c, 0x9d, 0x15, 0x19, 0xed, 0xe9, 0x4f, 0x8a, 0xe1, 0x64, 0x54, + 0xa1, 0x72, 0xe2, 0x3e, 0xc2, 0x68, 0x2e, 0x93, 0x14, 0xc3, 0x87, 0xb8, 0x88, 0xee, 0x05, 0x26, + 0x74, 0x0c, 0xed, 0x38, 0xf7, 0x63, 0xc9, 0x88, 0x43, 0xbc, 0x3e, 0x2f, 0x09, 0x65, 0xd0, 0x45, + 0x99, 0x14, 0xaf, 0x79, 0xc0, 0x9a, 0xfa, 0x7f, 0x45, 0xcd, 0x44, 0x8a, 0x42, 0xb0, 0x96, 0x43, + 0xbc, 0x21, 0xaf, 0xa8, 0xfb, 0x46, 0xa0, 0xaf, 0x24, 0x6f, 0xc4, 0x22, 0x58, 0xd2, 0x7f, 0xd0, + 0x29, 0x04, 0x26, 0xb5, 0xb0, 0x61, 0x74, 0x02, 0x3d, 0x85, 0x56, 0x22, 0xad, 0xa4, 0x6b, 0x4e, + 0x2f, 0xa0, 0x87, 0x32, 0x89, 0x57, 0x4f, 0x19, 0x32, 0xcb, 0xb1, 0xbc, 0xc1, 0x8c, 0x4d, 0xeb, + 0x00, 0xa7, 0xbe, 0x79, 0xbd, 0xa9, 0x13, 0xac, 0x64, 0xf0, 0xa2, 0xfd, 0xb4, 0x79, 0x49, 0xdc, + 0x0f, 0x02, 0x30, 0x97, 0xc9, 0x6d, 0x80, 0x28, 0xc2, 0x80, 0xfe, 0x01, 0xeb, 0x10, 0x52, 0x41, + 0x75, 0xe6, 0x0b, 0x29, 0xd7, 0xc6, 0x45, 0x49, 0xe8, 0x19, 0x74, 0x95, 0x9d, 0xa5, 0x58, 0x30, + 0xcb, 0x21, 0xde, 0x60, 0xf6, 0xf7, 0xe0, 0xa0, 0x0e, 0xc7, 0xab, 0x1d, 0x4a, 0xa1, 0x75, 0x54, + 0x85, 0xc6, 0xd4, 0x83, 0x56, 0xbe, 0xc1, 0x88, 0xb5, 0xf5, 0xfd, 0xf8, 0x70, 0x7f, 0xb7, 0xc1, + 0xe8, 0xb2, 0x28, 0x84, 0x1f, 0x71, 0xbd, 0xe1, 0x5e, 0x43, 0x77, 0x1d, 0xf8, 0xcf, 0x29, 0x86, + 0x74, 0x04, 0xcd, 0xda, 0x5e, 0x33, 0x96, 0x4a, 0xf8, 0xc8, 0x9c, 0xc6, 0xaa, 0xfa, 0x3c, 0xf6, + 0xf5, 0x7b, 0x56, 0x59, 0xbd, 0xa1, 0x6e, 0x06, 0x03, 0xbe, 0x59, 0x06, 0x55, 0xd8, 0xdf, 0x74, + 0xff, 0x1f, 0x3a, 0xa8, 0x1b, 0x36, 0xb9, 0xc7, 0x27, 0xcd, 0x1b, 0x65, 0x6e, 0x76, 0xae, 0xd8, + 0xe7, 0xce, 0x26, 0xdb, 0x9d, 0x4d, 0xbe, 0x77, 0x36, 0x79, 0xdf, 0xdb, 0x8d, 0xed, 0xde, 0x6e, + 0x7c, 0xed, 0xed, 0xc6, 0xa2, 0xa3, 0xcf, 0xce, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x56, 0x3f, + 0xf7, 0xf6, 0x92, 0x02, 0x00, 0x00, } func (m *SdkmsgWithTask) Marshal() (dAtA []byte, err error) { @@ -436,6 +510,16 @@ i = encodeVarintCommsg(dAtA, i, uint64(len(m.Data))) i += copy(dAtA[i:], m.Data) } + if m.Push != nil { + dAtA[i] = 0x2a + i++ + i = encodeVarintCommsg(dAtA, i, uint64(m.Push.Size())) + n2, err2 := m.Push.MarshalTo(dAtA[i:]) + if err2 != nil { + return 0, err2 + } + i += n2 + } return i, nil } @@ -471,6 +555,46 @@ i++ i = encodeVarintCommsg(dAtA, i, uint64(len(m.Picdata))) i += copy(dAtA[i:], m.Picdata) + } + return i, nil +} + +func (m *RuleMessage) 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 *RuleMessage) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Taskid) > 0 { + dAtA[i] = 0xa + i++ + i = encodeVarintCommsg(dAtA, i, uint64(len(m.Taskid))) + i += copy(dAtA[i:], m.Taskid) + } + if len(m.Taskname) > 0 { + dAtA[i] = 0x12 + i++ + i = encodeVarintCommsg(dAtA, i, uint64(len(m.Taskname))) + i += copy(dAtA[i:], m.Taskname) + } + if m.Sdkmsg != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintCommsg(dAtA, i, uint64(m.Sdkmsg.Size())) + n3, err3 := m.Sdkmsg.MarshalTo(dAtA[i:]) + if err3 != nil { + return 0, err3 + } + i += n3 } return i, nil } @@ -553,6 +677,10 @@ if l > 0 { n += 1 + l + sovCommsg(uint64(l)) } + if m.Push != nil { + l = m.Push.Size() + n += 1 + l + sovCommsg(uint64(l)) + } return n } @@ -577,15 +705,29 @@ return n } -func sovCommsg(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } +func (m *RuleMessage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Taskid) + if l > 0 { + n += 1 + l + sovCommsg(uint64(l)) + } + l = len(m.Taskname) + if l > 0 { + n += 1 + l + sovCommsg(uint64(l)) + } + if m.Sdkmsg != nil { + l = m.Sdkmsg.Size() + n += 1 + l + sovCommsg(uint64(l)) } return n +} + +func sovCommsg(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 } func sozCommsg(x uint64) (n int) { return sovCommsg(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -1074,6 +1216,42 @@ m.Data = []byte{} } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Push", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommsg + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommsg + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommsg + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Push == nil { + m.Push = &PushAttach{} + } + if err := m.Push.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipCommsg(dAtA[iNdEx:]) @@ -1249,6 +1427,159 @@ } return nil } +func (m *RuleMessage) 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 ErrIntOverflowCommsg + } + 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: RuleMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RuleMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Taskid", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommsg + } + 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 ErrInvalidLengthCommsg + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommsg + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Taskid = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Taskname", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommsg + } + 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 ErrInvalidLengthCommsg + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCommsg + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Taskname = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sdkmsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCommsg + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthCommsg + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthCommsg + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Sdkmsg == nil { + m.Sdkmsg = &SdkMessage{} + } + if err := m.Sdkmsg.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCommsg(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthCommsg + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthCommsg + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipCommsg(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 -- Gitblit v1.8.0