From 37996618243097b211ef1522f38ec14b62047d88 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Mon, 9 Aug 2021 16:07:34 +0800 Subject: [PATCH] grpc change to dtmpb --- dtmcli/dtmcli.pb.go => dtmpb/dtmpb.pb.go | 184 +++++++++--------- dtmcli/dtmcli.proto => dtmpb/dtmpb.proto | 2 +- .../dtmpb_grpc.pb.go | 4 +- dtmcli/msg_grpc.go => dtmpb/msg.go | 16 +- dtmsvr/api_grpc.go | 6 +- dtmsvr/main.go | 4 +- examples/busi.pb.go | 48 ++--- examples/busi.proto | 2 +- examples/busi_grpc.pb.go | 72 +++---- examples/main_base.go | 5 +- examples/main_grpc.go | 6 +- examples/main_msg_pb.go | 3 +- 12 files changed, 179 insertions(+), 173 deletions(-) rename dtmcli/dtmcli.pb.go => dtmpb/dtmpb.pb.go (62%) rename dtmcli/dtmcli.proto => dtmpb/dtmpb.proto (94%) rename dtmcli/dtmcli_grpc.pb.go => dtmpb/dtmpb_grpc.pb.go (98%) rename dtmcli/msg_grpc.go => dtmpb/msg.go (73%) diff --git a/dtmcli/dtmcli.pb.go b/dtmpb/dtmpb.pb.go similarity index 62% rename from dtmcli/dtmcli.pb.go rename to dtmpb/dtmpb.pb.go index 8012660..3c97a2d 100644 --- a/dtmcli/dtmcli.pb.go +++ b/dtmpb/dtmpb.pb.go @@ -2,9 +2,9 @@ // versions: // protoc-gen-go v1.26.0 // protoc v3.17.3 -// source: dtmcli/dtmcli.proto +// source: dtmpb/dtmpb.proto -package dtmcli +package dtmpb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -34,7 +34,7 @@ type DtmTransInfo struct { func (x *DtmTransInfo) Reset() { *x = DtmTransInfo{} if protoimpl.UnsafeEnabled { - mi := &file_dtmcli_dtmcli_proto_msgTypes[0] + mi := &file_dtmpb_dtmpb_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -47,7 +47,7 @@ func (x *DtmTransInfo) String() string { func (*DtmTransInfo) ProtoMessage() {} func (x *DtmTransInfo) ProtoReflect() protoreflect.Message { - mi := &file_dtmcli_dtmcli_proto_msgTypes[0] + mi := &file_dtmpb_dtmpb_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -60,7 +60,7 @@ func (x *DtmTransInfo) ProtoReflect() protoreflect.Message { // Deprecated: Use DtmTransInfo.ProtoReflect.Descriptor instead. func (*DtmTransInfo) Descriptor() ([]byte, []int) { - return file_dtmcli_dtmcli_proto_rawDescGZIP(), []int{0} + return file_dtmpb_dtmpb_proto_rawDescGZIP(), []int{0} } func (x *DtmTransInfo) GetGid() string { @@ -108,7 +108,7 @@ type DtmRequest struct { func (x *DtmRequest) Reset() { *x = DtmRequest{} if protoimpl.UnsafeEnabled { - mi := &file_dtmcli_dtmcli_proto_msgTypes[1] + mi := &file_dtmpb_dtmpb_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -121,7 +121,7 @@ func (x *DtmRequest) String() string { func (*DtmRequest) ProtoMessage() {} func (x *DtmRequest) ProtoReflect() protoreflect.Message { - mi := &file_dtmcli_dtmcli_proto_msgTypes[1] + mi := &file_dtmpb_dtmpb_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -134,7 +134,7 @@ func (x *DtmRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DtmRequest.ProtoReflect.Descriptor instead. func (*DtmRequest) Descriptor() ([]byte, []int) { - return file_dtmcli_dtmcli_proto_rawDescGZIP(), []int{1} + return file_dtmpb_dtmpb_proto_rawDescGZIP(), []int{1} } func (x *DtmRequest) GetGid() string { @@ -192,7 +192,7 @@ type DtmReply struct { func (x *DtmReply) Reset() { *x = DtmReply{} if protoimpl.UnsafeEnabled { - mi := &file_dtmcli_dtmcli_proto_msgTypes[2] + mi := &file_dtmpb_dtmpb_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -205,7 +205,7 @@ func (x *DtmReply) String() string { func (*DtmReply) ProtoMessage() {} func (x *DtmReply) ProtoReflect() protoreflect.Message { - mi := &file_dtmcli_dtmcli_proto_msgTypes[2] + mi := &file_dtmpb_dtmpb_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -218,7 +218,7 @@ func (x *DtmReply) ProtoReflect() protoreflect.Message { // Deprecated: Use DtmReply.ProtoReflect.Descriptor instead. func (*DtmReply) Descriptor() ([]byte, []int) { - return file_dtmcli_dtmcli_proto_rawDescGZIP(), []int{2} + return file_dtmpb_dtmpb_proto_rawDescGZIP(), []int{2} } func (x *DtmReply) GetDtmResult() string { @@ -249,7 +249,7 @@ type BusiRequest struct { func (x *BusiRequest) Reset() { *x = BusiRequest{} if protoimpl.UnsafeEnabled { - mi := &file_dtmcli_dtmcli_proto_msgTypes[3] + mi := &file_dtmpb_dtmpb_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -262,7 +262,7 @@ func (x *BusiRequest) String() string { func (*BusiRequest) ProtoMessage() {} func (x *BusiRequest) ProtoReflect() protoreflect.Message { - mi := &file_dtmcli_dtmcli_proto_msgTypes[3] + mi := &file_dtmpb_dtmpb_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -275,7 +275,7 @@ func (x *BusiRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use BusiRequest.ProtoReflect.Descriptor instead. func (*BusiRequest) Descriptor() ([]byte, []int) { - return file_dtmcli_dtmcli_proto_rawDescGZIP(), []int{3} + return file_dtmpb_dtmpb_proto_rawDescGZIP(), []int{3} } func (x *BusiRequest) GetInfo() *DtmTransInfo { @@ -312,7 +312,7 @@ type BusiReply struct { func (x *BusiReply) Reset() { *x = BusiReply{} if protoimpl.UnsafeEnabled { - mi := &file_dtmcli_dtmcli_proto_msgTypes[4] + mi := &file_dtmpb_dtmpb_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -325,7 +325,7 @@ func (x *BusiReply) String() string { func (*BusiReply) ProtoMessage() {} func (x *BusiReply) ProtoReflect() protoreflect.Message { - mi := &file_dtmcli_dtmcli_proto_msgTypes[4] + mi := &file_dtmpb_dtmpb_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -338,7 +338,7 @@ func (x *BusiReply) ProtoReflect() protoreflect.Message { // Deprecated: Use BusiReply.ProtoReflect.Descriptor instead. func (*BusiReply) Descriptor() ([]byte, []int) { - return file_dtmcli_dtmcli_proto_rawDescGZIP(), []int{4} + return file_dtmpb_dtmpb_proto_rawDescGZIP(), []int{4} } func (x *BusiReply) GetDtmResult() string { @@ -355,78 +355,78 @@ func (x *BusiReply) GetDtmMessage() string { return "" } -var File_dtmcli_dtmcli_proto protoreflect.FileDescriptor +var File_dtmpb_dtmpb_proto protoreflect.FileDescriptor -var file_dtmcli_dtmcli_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2f, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x22, 0x6c, 0x0a, - 0x0c, 0x44, 0x74, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, - 0x03, 0x47, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x47, 0x69, 0x64, 0x12, - 0x1c, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, - 0x08, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x44, 0x74, 0x6d, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x44, 0x74, 0x6d, 0x22, 0x83, 0x02, 0x0a, 0x0a, - 0x44, 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x47, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x47, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, - 0x12, 0x16, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, - 0x61, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, - 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x78, 0x74, 0x72, - 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x18, 0x0a, - 0x07, 0x41, 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, - 0x41, 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, 0x74, 0x72, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x48, 0x0a, 0x08, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, - 0x09, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x44, - 0x74, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x44, 0x74, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xc1, 0x01, 0x0a, 0x0b, - 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x69, - 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x74, 0x6d, 0x63, - 0x6c, 0x69, 0x2e, 0x44, 0x74, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, - 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, +var file_dtmpb_dtmpb_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x64, 0x74, 0x6d, 0x70, 0x62, 0x2f, 0x64, 0x74, 0x6d, 0x70, 0x62, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x22, 0x6c, 0x0a, 0x0c, 0x44, + 0x74, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x47, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x47, 0x69, 0x64, 0x12, 0x1c, 0x0a, + 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x42, + 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x42, + 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x44, 0x74, 0x6d, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x44, 0x74, 0x6d, 0x22, 0x83, 0x02, 0x0a, 0x0a, 0x44, 0x74, + 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x47, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x47, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x4d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x33, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x44, + 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x41, - 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x41, 0x70, + 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x41, 0x70, 0x70, 0x44, 0x61, 0x74, 0x61, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0x49, 0x0a, 0x09, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, 0x09, - 0x44, 0x74, 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x44, 0x74, - 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x44, 0x74, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x35, 0x0a, 0x03, 0x44, 0x74, - 0x6d, 0x12, 0x2e, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x12, 0x2e, 0x64, 0x74, 0x6d, 0x63, - 0x6c, 0x69, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, - 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x42, 0x1c, 0x5a, 0x1a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x79, 0x65, 0x64, 0x66, 0x2f, 0x64, 0x74, 0x6d, 0x2f, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x48, 0x0a, 0x08, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x44, + 0x74, 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x44, 0x74, 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x44, 0x74, 0x6d, + 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x44, + 0x74, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0xc1, 0x01, 0x0a, 0x0b, 0x42, 0x75, + 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x04, 0x69, 0x6e, 0x66, + 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, + 0x2e, 0x44, 0x74, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, + 0x6e, 0x66, 0x6f, 0x12, 0x34, 0x0a, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x05, 0x45, 0x78, 0x74, 0x72, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x41, 0x70, 0x70, + 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x41, 0x70, 0x70, 0x44, + 0x61, 0x74, 0x61, 0x1a, 0x38, 0x0a, 0x0a, 0x45, 0x78, 0x74, 0x72, 0x61, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x49, 0x0a, + 0x09, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x44, 0x74, + 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x44, + 0x74, 0x6d, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x44, 0x74, 0x6d, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x44, 0x74, + 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x35, 0x0a, 0x03, 0x44, 0x74, 0x6d, 0x12, + 0x2e, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x12, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, + 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x64, 0x74, + 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, + 0x1b, 0x5a, 0x19, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x65, + 0x64, 0x66, 0x2f, 0x64, 0x74, 0x6d, 0x2f, 0x64, 0x74, 0x6d, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( - file_dtmcli_dtmcli_proto_rawDescOnce sync.Once - file_dtmcli_dtmcli_proto_rawDescData = file_dtmcli_dtmcli_proto_rawDesc + file_dtmpb_dtmpb_proto_rawDescOnce sync.Once + file_dtmpb_dtmpb_proto_rawDescData = file_dtmpb_dtmpb_proto_rawDesc ) -func file_dtmcli_dtmcli_proto_rawDescGZIP() []byte { - file_dtmcli_dtmcli_proto_rawDescOnce.Do(func() { - file_dtmcli_dtmcli_proto_rawDescData = protoimpl.X.CompressGZIP(file_dtmcli_dtmcli_proto_rawDescData) +func file_dtmpb_dtmpb_proto_rawDescGZIP() []byte { + file_dtmpb_dtmpb_proto_rawDescOnce.Do(func() { + file_dtmpb_dtmpb_proto_rawDescData = protoimpl.X.CompressGZIP(file_dtmpb_dtmpb_proto_rawDescData) }) - return file_dtmcli_dtmcli_proto_rawDescData + return file_dtmpb_dtmpb_proto_rawDescData } -var file_dtmcli_dtmcli_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_dtmcli_dtmcli_proto_goTypes = []interface{}{ +var file_dtmpb_dtmpb_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_dtmpb_dtmpb_proto_goTypes = []interface{}{ (*DtmTransInfo)(nil), // 0: dtmcli.DtmTransInfo (*DtmRequest)(nil), // 1: dtmcli.DtmRequest (*DtmReply)(nil), // 2: dtmcli.DtmReply @@ -435,7 +435,7 @@ var file_dtmcli_dtmcli_proto_goTypes = []interface{}{ nil, // 5: dtmcli.DtmRequest.ExtraEntry nil, // 6: dtmcli.BusiRequest.ExtraEntry } -var file_dtmcli_dtmcli_proto_depIdxs = []int32{ +var file_dtmpb_dtmpb_proto_depIdxs = []int32{ 5, // 0: dtmcli.DtmRequest.Extra:type_name -> dtmcli.DtmRequest.ExtraEntry 0, // 1: dtmcli.BusiRequest.info:type_name -> dtmcli.DtmTransInfo 6, // 2: dtmcli.BusiRequest.Extra:type_name -> dtmcli.BusiRequest.ExtraEntry @@ -448,13 +448,13 @@ var file_dtmcli_dtmcli_proto_depIdxs = []int32{ 0, // [0:3] is the sub-list for field type_name } -func init() { file_dtmcli_dtmcli_proto_init() } -func file_dtmcli_dtmcli_proto_init() { - if File_dtmcli_dtmcli_proto != nil { +func init() { file_dtmpb_dtmpb_proto_init() } +func file_dtmpb_dtmpb_proto_init() { + if File_dtmpb_dtmpb_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_dtmcli_dtmcli_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_dtmpb_dtmpb_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DtmTransInfo); i { case 0: return &v.state @@ -466,7 +466,7 @@ func file_dtmcli_dtmcli_proto_init() { return nil } } - file_dtmcli_dtmcli_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_dtmpb_dtmpb_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DtmRequest); i { case 0: return &v.state @@ -478,7 +478,7 @@ func file_dtmcli_dtmcli_proto_init() { return nil } } - file_dtmcli_dtmcli_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_dtmpb_dtmpb_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DtmReply); i { case 0: return &v.state @@ -490,7 +490,7 @@ func file_dtmcli_dtmcli_proto_init() { return nil } } - file_dtmcli_dtmcli_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_dtmpb_dtmpb_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BusiRequest); i { case 0: return &v.state @@ -502,7 +502,7 @@ func file_dtmcli_dtmcli_proto_init() { return nil } } - file_dtmcli_dtmcli_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_dtmpb_dtmpb_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BusiReply); i { case 0: return &v.state @@ -519,18 +519,18 @@ func file_dtmcli_dtmcli_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_dtmcli_dtmcli_proto_rawDesc, + RawDescriptor: file_dtmpb_dtmpb_proto_rawDesc, NumEnums: 0, NumMessages: 7, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_dtmcli_dtmcli_proto_goTypes, - DependencyIndexes: file_dtmcli_dtmcli_proto_depIdxs, - MessageInfos: file_dtmcli_dtmcli_proto_msgTypes, + GoTypes: file_dtmpb_dtmpb_proto_goTypes, + DependencyIndexes: file_dtmpb_dtmpb_proto_depIdxs, + MessageInfos: file_dtmpb_dtmpb_proto_msgTypes, }.Build() - File_dtmcli_dtmcli_proto = out.File - file_dtmcli_dtmcli_proto_rawDesc = nil - file_dtmcli_dtmcli_proto_goTypes = nil - file_dtmcli_dtmcli_proto_depIdxs = nil + File_dtmpb_dtmpb_proto = out.File + file_dtmpb_dtmpb_proto_rawDesc = nil + file_dtmpb_dtmpb_proto_goTypes = nil + file_dtmpb_dtmpb_proto_depIdxs = nil } diff --git a/dtmcli/dtmcli.proto b/dtmpb/dtmpb.proto similarity index 94% rename from dtmcli/dtmcli.proto rename to dtmpb/dtmpb.proto index 3353345..4374308 100644 --- a/dtmcli/dtmcli.proto +++ b/dtmpb/dtmpb.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -option go_package = "github.com/yedf/dtm/dtmcli"; +option go_package = "github.com/yedf/dtm/dtmpb"; package dtmcli; diff --git a/dtmcli/dtmcli_grpc.pb.go b/dtmpb/dtmpb_grpc.pb.go similarity index 98% rename from dtmcli/dtmcli_grpc.pb.go rename to dtmpb/dtmpb_grpc.pb.go index dcc0c37..54158b0 100644 --- a/dtmcli/dtmcli_grpc.pb.go +++ b/dtmpb/dtmpb_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. -package dtmcli +package dtmpb import ( context "context" @@ -97,5 +97,5 @@ var Dtm_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "dtmcli/dtmcli.proto", + Metadata: "dtmpb/dtmpb.proto", } diff --git a/dtmcli/msg_grpc.go b/dtmpb/msg.go similarity index 73% rename from dtmcli/msg_grpc.go rename to dtmpb/msg.go index b8a8902..8a6dea2 100644 --- a/dtmcli/msg_grpc.go +++ b/dtmpb/msg.go @@ -1,14 +1,16 @@ -package dtmcli +package dtmpb + +import "github.com/yedf/dtm/dtmcli" // MsgGrpc reliable msg type type MsgGrpc struct { MsgDataGrpc - TransBase + dtmcli.TransBase } // MsgDataGrpc msg data type MsgDataGrpc struct { - TransData + dtmcli.TransData Steps []MsgStepGrpc `json:"steps"` QueryPrepared string `json:"query_prepared"` } @@ -22,11 +24,11 @@ type MsgStepGrpc struct { // NewMsgGrpc create new msg func NewMsgGrpc(server string, gid string) *MsgGrpc { return &MsgGrpc{ - MsgDataGrpc: MsgDataGrpc{TransData: TransData{ + MsgDataGrpc: MsgDataGrpc{TransData: dtmcli.TransData{ Gid: gid, TransType: "msg", }}, - TransBase: TransBase{ + TransBase: dtmcli.TransBase{ Dtm: server, }, } @@ -34,10 +36,10 @@ func NewMsgGrpc(server string, gid string) *MsgGrpc { // Add add a new step func (s *MsgGrpc) Add(action string, postData interface{}) *MsgGrpc { - Logf("msg %s Add %s %v", s.MsgDataGrpc.Gid, action, postData) + dtmcli.Logf("msg %s Add %s %v", s.MsgDataGrpc.Gid, action, postData) step := MsgStepGrpc{ Action: action, - Data: MustMarshalString(postData), + Data: dtmcli.MustMarshalString(postData), } s.Steps = append(s.Steps, step) return s diff --git a/dtmsvr/api_grpc.go b/dtmsvr/api_grpc.go index 55e2309..c3c64a0 100644 --- a/dtmsvr/api_grpc.go +++ b/dtmsvr/api_grpc.go @@ -6,7 +6,7 @@ import ( "strings" "github.com/yedf/dtm/dtmcli" - pb "github.com/yedf/dtm/dtmcli" + pb "github.com/yedf/dtm/dtmpb" "google.golang.org/grpc" ) @@ -28,8 +28,8 @@ func dynamicCallPb(ctx context.Context, in *pb.DtmRequest, pbAddr string, data [ method := "/" + strings.Join(fs[1:], "/") conn, err := grpc.Dial(grpcAddr, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithUnaryInterceptor(dtmcli.GrpcClientLog)) dtmcli.FatalIfError(err) - reply := &dtmcli.BusiReply{} - err = conn.Invoke(ctx, method, &dtmcli.BusiRequest{Info: &dtmcli.DtmTransInfo{Gid: in.Gid}}, reply) + reply := &pb.BusiReply{} + err = conn.Invoke(ctx, method, &pb.BusiRequest{Info: &pb.DtmTransInfo{Gid: in.Gid}}, reply) dtmcli.FatalIfError(err) return err } diff --git a/dtmsvr/main.go b/dtmsvr/main.go index 3c12a31..caeb97b 100644 --- a/dtmsvr/main.go +++ b/dtmsvr/main.go @@ -7,6 +7,8 @@ import ( "github.com/yedf/dtm/common" "github.com/yedf/dtm/dtmcli" + "github.com/yedf/dtm/dtmpb" + "github.com/yedf/dtm/examples" "google.golang.org/grpc" ) @@ -25,7 +27,7 @@ func StartSvr() { lis, err := net.Listen("tcp", fmt.Sprintf(":%d", dtmsvrGrpcPort)) dtmcli.FatalIfError(err) s := grpc.NewServer(grpc.UnaryInterceptor(dtmcli.GrpcServerLog)) - dtmcli.RegisterDtmServer(s, &dtmServer{}) + dtmpb.RegisterDtmServer(s, &dtmServer{}) dtmcli.Logf("grpc listening at %v", lis.Addr()) go func() { err := s.Serve(lis) diff --git a/examples/busi.pb.go b/examples/busi.pb.go index 83e6c33..97efcaa 100644 --- a/examples/busi.pb.go +++ b/examples/busi.pb.go @@ -7,7 +7,7 @@ package examples import ( - dtmcli "github.com/yedf/dtm/dtmcli" + dtmpb "github.com/yedf/dtm/dtmpb" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -25,33 +25,33 @@ var File_examples_busi_proto protoreflect.FileDescriptor var file_examples_busi_proto_rawDesc = []byte{ 0x0a, 0x13, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x2f, 0x62, 0x75, 0x73, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x1a, - 0x13, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2f, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x32, 0x9a, 0x02, 0x0a, 0x04, 0x42, 0x75, 0x73, 0x69, 0x12, 0x30, 0x0a, - 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, + 0x11, 0x64, 0x74, 0x6d, 0x70, 0x62, 0x2f, 0x64, 0x74, 0x6d, 0x70, 0x62, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x32, 0x9a, 0x02, 0x0a, 0x04, 0x42, 0x75, 0x73, 0x69, 0x12, 0x30, 0x0a, 0x04, 0x43, + 0x61, 0x6c, 0x6c, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, + 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, + 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x33, 0x0a, + 0x07, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x49, 0x6e, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, + 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, + 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x12, 0x34, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x4f, 0x75, 0x74, 0x12, 0x13, + 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, + 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0d, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x49, 0x6e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x74, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x63, + 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, + 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x4f, 0x75, 0x74, 0x52, + 0x65, 0x76, 0x65, 0x72, 0x74, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x64, 0x74, 0x6d, - 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x33, 0x0a, 0x07, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x49, 0x6e, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, - 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x11, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x12, 0x34, 0x0a, 0x08, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x4f, 0x75, 0x74, - 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, - 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x39, 0x0a, 0x0d, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x49, 0x6e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x74, 0x12, 0x13, 0x2e, 0x64, 0x74, - 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x11, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x4f, 0x75, - 0x74, 0x52, 0x65, 0x76, 0x65, 0x72, 0x74, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x63, 0x6c, 0x69, - 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x64, - 0x74, 0x6d, 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x42, 0x1e, 0x5a, 0x1c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x79, 0x65, 0x64, 0x66, 0x2f, 0x64, 0x74, 0x6d, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x6c, 0x69, 0x2e, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, + 0x1e, 0x5a, 0x1c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x65, + 0x64, 0x66, 0x2f, 0x64, 0x74, 0x6d, 0x2f, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_examples_busi_proto_goTypes = []interface{}{ - (*dtmcli.BusiRequest)(nil), // 0: dtmcli.BusiRequest - (*dtmcli.BusiReply)(nil), // 1: dtmcli.BusiReply + (*dtmpb.BusiRequest)(nil), // 0: dtmcli.BusiRequest + (*dtmpb.BusiReply)(nil), // 1: dtmcli.BusiReply } var file_examples_busi_proto_depIdxs = []int32{ 0, // 0: examples.Busi.Call:input_type -> dtmcli.BusiRequest diff --git a/examples/busi.proto b/examples/busi.proto index 3613803..9388da8 100644 --- a/examples/busi.proto +++ b/examples/busi.proto @@ -3,7 +3,7 @@ syntax = "proto3"; package examples; option go_package = "github.com/yedf/dtm/examples"; -import "dtmcli/dtmcli.proto"; +import "dtmpb/dtmpb.proto"; // The dtm service definition. service Busi { diff --git a/examples/busi_grpc.pb.go b/examples/busi_grpc.pb.go index a5c6b30..06ba646 100644 --- a/examples/busi_grpc.pb.go +++ b/examples/busi_grpc.pb.go @@ -4,7 +4,7 @@ package examples import ( context "context" - dtmcli "github.com/yedf/dtm/dtmcli" + dtmpb "github.com/yedf/dtm/dtmpb" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -19,11 +19,11 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type BusiClient interface { - Call(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) - TransIn(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) - TransOut(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) - TransInRevert(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) - TransOutRevert(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) + Call(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) + TransIn(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) + TransOut(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) + TransInRevert(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) + TransOutRevert(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) } type busiClient struct { @@ -34,8 +34,8 @@ func NewBusiClient(cc grpc.ClientConnInterface) BusiClient { return &busiClient{cc} } -func (c *busiClient) Call(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) { - out := new(dtmcli.BusiReply) +func (c *busiClient) Call(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) { + out := new(dtmpb.BusiReply) err := c.cc.Invoke(ctx, "/examples.Busi/Call", in, out, opts...) if err != nil { return nil, err @@ -43,8 +43,8 @@ func (c *busiClient) Call(ctx context.Context, in *dtmcli.BusiRequest, opts ...g return out, nil } -func (c *busiClient) TransIn(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) { - out := new(dtmcli.BusiReply) +func (c *busiClient) TransIn(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) { + out := new(dtmpb.BusiReply) err := c.cc.Invoke(ctx, "/examples.Busi/TransIn", in, out, opts...) if err != nil { return nil, err @@ -52,8 +52,8 @@ func (c *busiClient) TransIn(ctx context.Context, in *dtmcli.BusiRequest, opts . return out, nil } -func (c *busiClient) TransOut(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) { - out := new(dtmcli.BusiReply) +func (c *busiClient) TransOut(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) { + out := new(dtmpb.BusiReply) err := c.cc.Invoke(ctx, "/examples.Busi/TransOut", in, out, opts...) if err != nil { return nil, err @@ -61,8 +61,8 @@ func (c *busiClient) TransOut(ctx context.Context, in *dtmcli.BusiRequest, opts return out, nil } -func (c *busiClient) TransInRevert(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) { - out := new(dtmcli.BusiReply) +func (c *busiClient) TransInRevert(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) { + out := new(dtmpb.BusiReply) err := c.cc.Invoke(ctx, "/examples.Busi/TransInRevert", in, out, opts...) if err != nil { return nil, err @@ -70,8 +70,8 @@ func (c *busiClient) TransInRevert(ctx context.Context, in *dtmcli.BusiRequest, return out, nil } -func (c *busiClient) TransOutRevert(ctx context.Context, in *dtmcli.BusiRequest, opts ...grpc.CallOption) (*dtmcli.BusiReply, error) { - out := new(dtmcli.BusiReply) +func (c *busiClient) TransOutRevert(ctx context.Context, in *dtmpb.BusiRequest, opts ...grpc.CallOption) (*dtmpb.BusiReply, error) { + out := new(dtmpb.BusiReply) err := c.cc.Invoke(ctx, "/examples.Busi/TransOutRevert", in, out, opts...) if err != nil { return nil, err @@ -83,11 +83,11 @@ func (c *busiClient) TransOutRevert(ctx context.Context, in *dtmcli.BusiRequest, // All implementations must embed UnimplementedBusiServer // for forward compatibility type BusiServer interface { - Call(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) - TransIn(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) - TransOut(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) - TransInRevert(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) - TransOutRevert(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) + Call(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) + TransIn(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) + TransOut(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) + TransInRevert(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) + TransOutRevert(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) mustEmbedUnimplementedBusiServer() } @@ -95,19 +95,19 @@ type BusiServer interface { type UnimplementedBusiServer struct { } -func (UnimplementedBusiServer) Call(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) { +func (UnimplementedBusiServer) Call(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Call not implemented") } -func (UnimplementedBusiServer) TransIn(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) { +func (UnimplementedBusiServer) TransIn(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) { return nil, status.Errorf(codes.Unimplemented, "method TransIn not implemented") } -func (UnimplementedBusiServer) TransOut(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) { +func (UnimplementedBusiServer) TransOut(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) { return nil, status.Errorf(codes.Unimplemented, "method TransOut not implemented") } -func (UnimplementedBusiServer) TransInRevert(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) { +func (UnimplementedBusiServer) TransInRevert(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) { return nil, status.Errorf(codes.Unimplemented, "method TransInRevert not implemented") } -func (UnimplementedBusiServer) TransOutRevert(context.Context, *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) { +func (UnimplementedBusiServer) TransOutRevert(context.Context, *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) { return nil, status.Errorf(codes.Unimplemented, "method TransOutRevert not implemented") } func (UnimplementedBusiServer) mustEmbedUnimplementedBusiServer() {} @@ -124,7 +124,7 @@ func RegisterBusiServer(s grpc.ServiceRegistrar, srv BusiServer) { } func _Busi_Call_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(dtmcli.BusiRequest) + in := new(dtmpb.BusiRequest) if err := dec(in); err != nil { return nil, err } @@ -136,13 +136,13 @@ func _Busi_Call_Handler(srv interface{}, ctx context.Context, dec func(interface FullMethod: "/examples.Busi/Call", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusiServer).Call(ctx, req.(*dtmcli.BusiRequest)) + return srv.(BusiServer).Call(ctx, req.(*dtmpb.BusiRequest)) } return interceptor(ctx, in, info, handler) } func _Busi_TransIn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(dtmcli.BusiRequest) + in := new(dtmpb.BusiRequest) if err := dec(in); err != nil { return nil, err } @@ -154,13 +154,13 @@ func _Busi_TransIn_Handler(srv interface{}, ctx context.Context, dec func(interf FullMethod: "/examples.Busi/TransIn", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusiServer).TransIn(ctx, req.(*dtmcli.BusiRequest)) + return srv.(BusiServer).TransIn(ctx, req.(*dtmpb.BusiRequest)) } return interceptor(ctx, in, info, handler) } func _Busi_TransOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(dtmcli.BusiRequest) + in := new(dtmpb.BusiRequest) if err := dec(in); err != nil { return nil, err } @@ -172,13 +172,13 @@ func _Busi_TransOut_Handler(srv interface{}, ctx context.Context, dec func(inter FullMethod: "/examples.Busi/TransOut", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusiServer).TransOut(ctx, req.(*dtmcli.BusiRequest)) + return srv.(BusiServer).TransOut(ctx, req.(*dtmpb.BusiRequest)) } return interceptor(ctx, in, info, handler) } func _Busi_TransInRevert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(dtmcli.BusiRequest) + in := new(dtmpb.BusiRequest) if err := dec(in); err != nil { return nil, err } @@ -190,13 +190,13 @@ func _Busi_TransInRevert_Handler(srv interface{}, ctx context.Context, dec func( FullMethod: "/examples.Busi/TransInRevert", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusiServer).TransInRevert(ctx, req.(*dtmcli.BusiRequest)) + return srv.(BusiServer).TransInRevert(ctx, req.(*dtmpb.BusiRequest)) } return interceptor(ctx, in, info, handler) } func _Busi_TransOutRevert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(dtmcli.BusiRequest) + in := new(dtmpb.BusiRequest) if err := dec(in); err != nil { return nil, err } @@ -208,7 +208,7 @@ func _Busi_TransOutRevert_Handler(srv interface{}, ctx context.Context, dec func FullMethod: "/examples.Busi/TransOutRevert", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(BusiServer).TransOutRevert(ctx, req.(*dtmcli.BusiRequest)) + return srv.(BusiServer).TransOutRevert(ctx, req.(*dtmpb.BusiRequest)) } return interceptor(ctx, in, info, handler) } diff --git a/examples/main_base.go b/examples/main_base.go index d44be45..fa6cc11 100644 --- a/examples/main_base.go +++ b/examples/main_base.go @@ -8,6 +8,7 @@ import ( "github.com/gin-gonic/gin" "github.com/yedf/dtm/common" "github.com/yedf/dtm/dtmcli" + dtmpb "github.com/yedf/dtm/dtmpb" grpc "google.golang.org/grpc" ) @@ -27,7 +28,7 @@ var Busi string = fmt.Sprintf("http://localhost:%d%s", BusiPort, BusiAPI) var BusiPb string = fmt.Sprintf("localhost:%d", BusiPbPort) // DtmClient grpc client for dtm -var DtmClient dtmcli.DtmClient = nil +var DtmClient dtmpb.DtmClient = nil // BaseAppStartup base app startup func BaseAppStartup() *gin.Engine { @@ -39,7 +40,7 @@ func BaseAppStartup() *gin.Engine { conn, err := grpc.Dial(DtmGrpcServer, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithUnaryInterceptor(dtmcli.GrpcClientLog)) dtmcli.FatalIfError(err) - DtmClient = dtmcli.NewDtmClient(conn) + DtmClient = dtmpb.NewDtmClient(conn) dtmcli.Logf("dtm client inited") lis, err := net.Listen("tcp", fmt.Sprintf(":%d", BusiPbPort)) diff --git a/examples/main_grpc.go b/examples/main_grpc.go index 1ca8a2f..8200613 100644 --- a/examples/main_grpc.go +++ b/examples/main_grpc.go @@ -4,7 +4,7 @@ import ( "context" "log" - dtmcli "github.com/yedf/dtm/dtmcli" + dtmpb "github.com/yedf/dtm/dtmpb" ) // busiServer is used to implement helloworld.GreeterServer. @@ -13,7 +13,7 @@ type busiServer struct { } // SayHello implements helloworld.GreeterServer -func (s *busiServer) Call(ctx context.Context, in *dtmcli.BusiRequest) (*dtmcli.BusiReply, error) { +func (s *busiServer) Call(ctx context.Context, in *dtmpb.BusiRequest) (*dtmpb.BusiReply, error) { log.Printf("busiServer received: %v", in) - return &dtmcli.BusiReply{DtmResult: "SUCCESS", DtmMessage: "ok"}, nil + return &dtmpb.BusiReply{DtmResult: "SUCCESS", DtmMessage: "ok"}, nil } diff --git a/examples/main_msg_pb.go b/examples/main_msg_pb.go index faec913..f47743c 100644 --- a/examples/main_msg_pb.go +++ b/examples/main_msg_pb.go @@ -5,6 +5,7 @@ import ( "github.com/gin-gonic/gin" "github.com/yedf/dtm/dtmcli" + dtmpb "github.com/yedf/dtm/dtmpb" ) // MsgPbSetup 1 @@ -15,7 +16,7 @@ func MsgPbSetup(app *gin.Engine) { // MsgPbFireRequest 1 func MsgPbFireRequest() string { dtmcli.Logf("MsgPbFireRequest") - reply, err := DtmClient.Call(context.Background(), &dtmcli.DtmRequest{ + reply, err := DtmClient.Call(context.Background(), &dtmpb.DtmRequest{ Gid: "pb_test", TransType: "msg", Method: "submit",