sample use register
This commit is contained in:
parent
693d6d56ea
commit
cef6a92463
26
app/main.go
26
app/main.go
@ -42,27 +42,9 @@ func main() {
|
|||||||
// 下面是各类的例子
|
// 下面是各类的例子
|
||||||
examples.BaseAppStartup()
|
examples.BaseAppStartup()
|
||||||
examples.GrpcStartup()
|
examples.GrpcStartup()
|
||||||
if os.Args[1] == "xa" { // 启动xa示例
|
|
||||||
examples.XaFireRequest()
|
fn := examples.Samples[os.Args[1]]
|
||||||
} else if os.Args[1] == "saga" { // 启动saga示例
|
dtmcli.LogIfFatalf(fn == nil, "no sample name for %s", os.Args[1])
|
||||||
examples.SagaFireRequest()
|
fn()
|
||||||
} else if os.Args[1] == "tcc" { // 启动tcc示例
|
|
||||||
examples.TccFireRequestNested()
|
|
||||||
} else if os.Args[1] == "msg" { // 启动msg示例
|
|
||||||
examples.MsgFireRequest()
|
|
||||||
} else if os.Args[1] == "msg_grpc" { // 启动msg示例
|
|
||||||
examples.MsgGrpcFireRequest()
|
|
||||||
} else if os.Args[1] == "all" { // 运行所有示例
|
|
||||||
examples.SagaFireRequest()
|
|
||||||
examples.TccFireRequestNested()
|
|
||||||
examples.XaFireRequest()
|
|
||||||
examples.MsgFireRequest()
|
|
||||||
} else if os.Args[1] == "saga_barrier" {
|
|
||||||
examples.SagaBarrierFireRequest()
|
|
||||||
} else if os.Args[1] == "tcc_barrier" {
|
|
||||||
examples.TccBarrierFireRequest()
|
|
||||||
} else {
|
|
||||||
dtmcli.LogRedf("unknown arg: %s", os.Args[1])
|
|
||||||
}
|
|
||||||
wait()
|
wait()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -104,6 +104,53 @@ func (x *DtmRequest) GetData() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type DtmGidReply struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Gid string `protobuf:"bytes,1,opt,name=Gid,proto3" json:"Gid,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DtmGidReply) Reset() {
|
||||||
|
*x = DtmGidReply{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DtmGidReply) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*DtmGidReply) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *DtmGidReply) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[1]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use DtmGidReply.ProtoReflect.Descriptor instead.
|
||||||
|
func (*DtmGidReply) Descriptor() ([]byte, []int) {
|
||||||
|
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *DtmGidReply) GetGid() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Gid
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// BranchInfo 事务分支信息
|
// BranchInfo 事务分支信息
|
||||||
type BranchInfo struct {
|
type BranchInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
@ -119,7 +166,7 @@ type BranchInfo struct {
|
|||||||
func (x *BranchInfo) Reset() {
|
func (x *BranchInfo) Reset() {
|
||||||
*x = BranchInfo{}
|
*x = BranchInfo{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[1]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[2]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -132,7 +179,7 @@ func (x *BranchInfo) String() string {
|
|||||||
func (*BranchInfo) ProtoMessage() {}
|
func (*BranchInfo) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *BranchInfo) ProtoReflect() protoreflect.Message {
|
func (x *BranchInfo) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[1]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[2]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -145,7 +192,7 @@ func (x *BranchInfo) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use BranchInfo.ProtoReflect.Descriptor instead.
|
// Deprecated: Use BranchInfo.ProtoReflect.Descriptor instead.
|
||||||
func (*BranchInfo) Descriptor() ([]byte, []int) {
|
func (*BranchInfo) Descriptor() ([]byte, []int) {
|
||||||
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{1}
|
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BranchInfo) GetGid() string {
|
func (x *BranchInfo) GetGid() string {
|
||||||
@ -191,7 +238,7 @@ type DtmTccBranchRequest struct {
|
|||||||
func (x *DtmTccBranchRequest) Reset() {
|
func (x *DtmTccBranchRequest) Reset() {
|
||||||
*x = DtmTccBranchRequest{}
|
*x = DtmTccBranchRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[2]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[3]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -204,7 +251,7 @@ func (x *DtmTccBranchRequest) String() string {
|
|||||||
func (*DtmTccBranchRequest) ProtoMessage() {}
|
func (*DtmTccBranchRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *DtmTccBranchRequest) ProtoReflect() protoreflect.Message {
|
func (x *DtmTccBranchRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[2]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[3]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -217,7 +264,7 @@ func (x *DtmTccBranchRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use DtmTccBranchRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use DtmTccBranchRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*DtmTccBranchRequest) Descriptor() ([]byte, []int) {
|
func (*DtmTccBranchRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{2}
|
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DtmTccBranchRequest) GetInfo() *BranchInfo {
|
func (x *DtmTccBranchRequest) GetInfo() *BranchInfo {
|
||||||
@ -269,7 +316,7 @@ type DtmXaBranchRequest struct {
|
|||||||
func (x *DtmXaBranchRequest) Reset() {
|
func (x *DtmXaBranchRequest) Reset() {
|
||||||
*x = DtmXaBranchRequest{}
|
*x = DtmXaBranchRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[3]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[4]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -282,7 +329,7 @@ func (x *DtmXaBranchRequest) String() string {
|
|||||||
func (*DtmXaBranchRequest) ProtoMessage() {}
|
func (*DtmXaBranchRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *DtmXaBranchRequest) ProtoReflect() protoreflect.Message {
|
func (x *DtmXaBranchRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[3]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[4]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -295,7 +342,7 @@ func (x *DtmXaBranchRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use DtmXaBranchRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use DtmXaBranchRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*DtmXaBranchRequest) Descriptor() ([]byte, []int) {
|
func (*DtmXaBranchRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{3}
|
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DtmXaBranchRequest) GetInfo() *BranchInfo {
|
func (x *DtmXaBranchRequest) GetInfo() *BranchInfo {
|
||||||
@ -333,7 +380,7 @@ type BusiRequest struct {
|
|||||||
func (x *BusiRequest) Reset() {
|
func (x *BusiRequest) Reset() {
|
||||||
*x = BusiRequest{}
|
*x = BusiRequest{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[4]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[5]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -346,7 +393,7 @@ func (x *BusiRequest) String() string {
|
|||||||
func (*BusiRequest) ProtoMessage() {}
|
func (*BusiRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *BusiRequest) ProtoReflect() protoreflect.Message {
|
func (x *BusiRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[4]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[5]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -359,7 +406,7 @@ func (x *BusiRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use BusiRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use BusiRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*BusiRequest) Descriptor() ([]byte, []int) {
|
func (*BusiRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{4}
|
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{5}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BusiRequest) GetInfo() *BranchInfo {
|
func (x *BusiRequest) GetInfo() *BranchInfo {
|
||||||
@ -395,7 +442,7 @@ type BusiReply struct {
|
|||||||
func (x *BusiReply) Reset() {
|
func (x *BusiReply) Reset() {
|
||||||
*x = BusiReply{}
|
*x = BusiReply{}
|
||||||
if protoimpl.UnsafeEnabled {
|
if protoimpl.UnsafeEnabled {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[5]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[6]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -408,7 +455,7 @@ func (x *BusiReply) String() string {
|
|||||||
func (*BusiReply) ProtoMessage() {}
|
func (*BusiReply) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *BusiReply) ProtoReflect() protoreflect.Message {
|
func (x *BusiReply) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[5]
|
mi := &file_dtmgrpc_dtmgrpc_proto_msgTypes[6]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -421,7 +468,7 @@ func (x *BusiReply) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use BusiReply.ProtoReflect.Descriptor instead.
|
// Deprecated: Use BusiReply.ProtoReflect.Descriptor instead.
|
||||||
func (*BusiReply) Descriptor() ([]byte, []int) {
|
func (*BusiReply) Descriptor() ([]byte, []int) {
|
||||||
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{5}
|
return file_dtmgrpc_dtmgrpc_proto_rawDescGZIP(), []int{6}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *BusiReply) GetBusiData() []byte {
|
func (x *BusiReply) GetBusiData() []byte {
|
||||||
@ -447,64 +494,69 @@ var file_dtmgrpc_dtmgrpc_proto_rawDesc = []byte{
|
|||||||
0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74,
|
0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74,
|
||||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75,
|
0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x57, 0x61, 0x69, 0x74, 0x52, 0x65, 0x73, 0x75,
|
||||||
0x6c, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
0x6c, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x78, 0x0a, 0x0a, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,
|
0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x1f, 0x0a, 0x0b, 0x44, 0x74, 0x6d, 0x47, 0x69, 0x64,
|
||||||
0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x47, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x47, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x09, 0x52, 0x03, 0x47, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x54,
|
0x28, 0x09, 0x52, 0x03, 0x47, 0x69, 0x64, 0x22, 0x78, 0x0a, 0x0a, 0x42, 0x72, 0x61, 0x6e, 0x63,
|
||||||
0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73,
|
0x68, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x47, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44,
|
0x28, 0x09, 0x52, 0x03, 0x47, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73,
|
||||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x44,
|
0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x54, 0x72, 0x61, 0x6e,
|
||||||
0x12, 0x1e, 0x0a, 0x0a, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x18, 0x04,
|
0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49,
|
||||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65,
|
0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49,
|
||||||
0x22, 0x9e, 0x01, 0x0a, 0x13, 0x44, 0x74, 0x6d, 0x54, 0x63, 0x63, 0x42, 0x72, 0x61, 0x6e, 0x63,
|
0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x18,
|
||||||
|
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x54, 0x79, 0x70,
|
||||||
|
0x65, 0x22, 0x9e, 0x01, 0x0a, 0x13, 0x44, 0x74, 0x6d, 0x54, 0x63, 0x63, 0x42, 0x72, 0x61, 0x6e,
|
||||||
|
0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66,
|
||||||
|
0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70,
|
||||||
|
0x63, 0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e,
|
||||||
|
0x66, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10,
|
||||||
|
0x0a, 0x03, 0x54, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x54, 0x72, 0x79,
|
||||||
|
0x12, 0x18, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61,
|
||||||
|
0x6e, 0x63, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x61, 0x6e, 0x63,
|
||||||
|
0x65, 0x6c, 0x22, 0x71, 0x0a, 0x12, 0x44, 0x74, 0x6d, 0x58, 0x61, 0x42, 0x72, 0x61, 0x6e, 0x63,
|
||||||
0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f,
|
0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63,
|
||||||
0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66,
|
0x2e, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66,
|
||||||
0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20,
|
0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20,
|
||||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a,
|
0x01, 0x28, 0x09, 0x52, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a,
|
||||||
0x03, 0x54, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x54, 0x72, 0x79, 0x12,
|
0x06, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e,
|
||||||
0x18, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
0x6f, 0x74, 0x69, 0x66, 0x79, 0x22, 0x64, 0x0a, 0x0b, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71,
|
||||||
0x52, 0x07, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x43, 0x61, 0x6e,
|
0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x63, 0x65, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x43, 0x61, 0x6e, 0x63, 0x65,
|
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x42, 0x72, 0x61,
|
||||||
0x6c, 0x22, 0x71, 0x0a, 0x12, 0x44, 0x74, 0x6d, 0x58, 0x61, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68,
|
0x6e, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18,
|
0x03, 0x44, 0x74, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x44, 0x74, 0x6d, 0x12,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e,
|
0x1a, 0x0a, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f,
|
0x0c, 0x52, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x22, 0x27, 0x0a, 0x09, 0x42,
|
||||||
0x12, 0x1a, 0x0a, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01,
|
0x75, 0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x75, 0x73, 0x69,
|
||||||
0x28, 0x09, 0x52, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x12, 0x16, 0x0a, 0x06,
|
0x44, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x42, 0x75, 0x73, 0x69,
|
||||||
0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x6f,
|
0x44, 0x61, 0x74, 0x61, 0x32, 0x82, 0x03, 0x0a, 0x03, 0x44, 0x74, 0x6d, 0x12, 0x38, 0x0a, 0x06,
|
||||||
0x74, 0x69, 0x66, 0x79, 0x22, 0x64, 0x0a, 0x0b, 0x42, 0x75, 0x73, 0x69, 0x52, 0x65, 0x71, 0x75,
|
0x4e, 0x65, 0x77, 0x47, 0x69, 0x64, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||||
0x65, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x14,
|
||||||
0x0b, 0x32, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x42, 0x72, 0x61, 0x6e,
|
0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x74, 0x6d, 0x47, 0x69, 0x64, 0x52,
|
||||||
0x63, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03,
|
0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x75, 0x62, 0x6d, 0x69, 0x74,
|
||||||
0x44, 0x74, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x44, 0x74, 0x6d, 0x12, 0x1a,
|
0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65,
|
||||||
0x0a, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||||
0x52, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44, 0x61, 0x74, 0x61, 0x22, 0x27, 0x0a, 0x09, 0x42, 0x75,
|
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12,
|
||||||
0x73, 0x69, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44,
|
0x38, 0x0a, 0x07, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d,
|
||||||
0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x42, 0x75, 0x73, 0x69, 0x44,
|
0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
0x61, 0x74, 0x61, 0x32, 0xc8, 0x02, 0x0a, 0x03, 0x44, 0x74, 0x6d, 0x12, 0x37, 0x0a, 0x06, 0x53,
|
0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||||
0x75, 0x62, 0x6d, 0x69, 0x74, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e,
|
0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x05, 0x41, 0x62, 0x6f,
|
||||||
0x44, 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f,
|
0x72, 0x74, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x74, 0x6d,
|
||||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70,
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||||
0x74, 0x79, 0x22, 0x00, 0x12, 0x38, 0x0a, 0x07, 0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x12,
|
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22,
|
||||||
0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x71,
|
0x00, 0x12, 0x4b, 0x0a, 0x11, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x54, 0x63, 0x63,
|
||||||
|
0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x1c, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63,
|
||||||
|
0x2e, 0x44, 0x74, 0x6d, 0x54, 0x63, 0x63, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71,
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
||||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x36,
|
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x49,
|
||||||
0x0a, 0x05, 0x41, 0x62, 0x6f, 0x72, 0x74, 0x12, 0x13, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70,
|
0x0a, 0x10, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x58, 0x61, 0x42, 0x72, 0x61, 0x6e,
|
||||||
0x63, 0x2e, 0x44, 0x74, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67,
|
0x63, 0x68, 0x12, 0x1b, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x74, 0x6d,
|
||||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
|
0x58, 0x61, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||||
0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x11, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74,
|
0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||||
0x65, 0x72, 0x54, 0x63, 0x63, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x1c, 0x2e, 0x64, 0x74,
|
0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x1d, 0x5a, 0x1b, 0x67, 0x69, 0x74,
|
||||||
0x6d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x74, 0x6d, 0x54, 0x63, 0x63, 0x42, 0x72, 0x61, 0x6e,
|
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x65, 0x64, 0x66, 0x2f, 0x64, 0x74, 0x6d,
|
||||||
0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
|
0x2f, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74,
|
|
||||||
0x79, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x10, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x58,
|
|
||||||
0x61, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x12, 0x1b, 0x2e, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70,
|
|
||||||
0x63, 0x2e, 0x44, 0x74, 0x6d, 0x58, 0x61, 0x42, 0x72, 0x61, 0x6e, 0x63, 0x68, 0x52, 0x65, 0x71,
|
|
||||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
|
||||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x00, 0x42, 0x1d,
|
|
||||||
0x5a, 0x1b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x65, 0x64,
|
|
||||||
0x66, 0x2f, 0x64, 0x74, 0x6d, 0x2f, 0x64, 0x74, 0x6d, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70,
|
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -519,32 +571,35 @@ func file_dtmgrpc_dtmgrpc_proto_rawDescGZIP() []byte {
|
|||||||
return file_dtmgrpc_dtmgrpc_proto_rawDescData
|
return file_dtmgrpc_dtmgrpc_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_dtmgrpc_dtmgrpc_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
var file_dtmgrpc_dtmgrpc_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
|
||||||
var file_dtmgrpc_dtmgrpc_proto_goTypes = []interface{}{
|
var file_dtmgrpc_dtmgrpc_proto_goTypes = []interface{}{
|
||||||
(*DtmRequest)(nil), // 0: dtmgrpc.DtmRequest
|
(*DtmRequest)(nil), // 0: dtmgrpc.DtmRequest
|
||||||
(*BranchInfo)(nil), // 1: dtmgrpc.BranchInfo
|
(*DtmGidReply)(nil), // 1: dtmgrpc.DtmGidReply
|
||||||
(*DtmTccBranchRequest)(nil), // 2: dtmgrpc.DtmTccBranchRequest
|
(*BranchInfo)(nil), // 2: dtmgrpc.BranchInfo
|
||||||
(*DtmXaBranchRequest)(nil), // 3: dtmgrpc.DtmXaBranchRequest
|
(*DtmTccBranchRequest)(nil), // 3: dtmgrpc.DtmTccBranchRequest
|
||||||
(*BusiRequest)(nil), // 4: dtmgrpc.BusiRequest
|
(*DtmXaBranchRequest)(nil), // 4: dtmgrpc.DtmXaBranchRequest
|
||||||
(*BusiReply)(nil), // 5: dtmgrpc.BusiReply
|
(*BusiRequest)(nil), // 5: dtmgrpc.BusiRequest
|
||||||
(*emptypb.Empty)(nil), // 6: google.protobuf.Empty
|
(*BusiReply)(nil), // 6: dtmgrpc.BusiReply
|
||||||
|
(*emptypb.Empty)(nil), // 7: google.protobuf.Empty
|
||||||
}
|
}
|
||||||
var file_dtmgrpc_dtmgrpc_proto_depIdxs = []int32{
|
var file_dtmgrpc_dtmgrpc_proto_depIdxs = []int32{
|
||||||
1, // 0: dtmgrpc.DtmTccBranchRequest.Info:type_name -> dtmgrpc.BranchInfo
|
2, // 0: dtmgrpc.DtmTccBranchRequest.Info:type_name -> dtmgrpc.BranchInfo
|
||||||
1, // 1: dtmgrpc.DtmXaBranchRequest.Info:type_name -> dtmgrpc.BranchInfo
|
2, // 1: dtmgrpc.DtmXaBranchRequest.Info:type_name -> dtmgrpc.BranchInfo
|
||||||
1, // 2: dtmgrpc.BusiRequest.Info:type_name -> dtmgrpc.BranchInfo
|
2, // 2: dtmgrpc.BusiRequest.Info:type_name -> dtmgrpc.BranchInfo
|
||||||
0, // 3: dtmgrpc.Dtm.Submit:input_type -> dtmgrpc.DtmRequest
|
7, // 3: dtmgrpc.Dtm.NewGid:input_type -> google.protobuf.Empty
|
||||||
0, // 4: dtmgrpc.Dtm.Prepare:input_type -> dtmgrpc.DtmRequest
|
0, // 4: dtmgrpc.Dtm.Submit:input_type -> dtmgrpc.DtmRequest
|
||||||
0, // 5: dtmgrpc.Dtm.Abort:input_type -> dtmgrpc.DtmRequest
|
0, // 5: dtmgrpc.Dtm.Prepare:input_type -> dtmgrpc.DtmRequest
|
||||||
2, // 6: dtmgrpc.Dtm.RegisterTccBranch:input_type -> dtmgrpc.DtmTccBranchRequest
|
0, // 6: dtmgrpc.Dtm.Abort:input_type -> dtmgrpc.DtmRequest
|
||||||
3, // 7: dtmgrpc.Dtm.RegisterXaBranch:input_type -> dtmgrpc.DtmXaBranchRequest
|
3, // 7: dtmgrpc.Dtm.RegisterTccBranch:input_type -> dtmgrpc.DtmTccBranchRequest
|
||||||
6, // 8: dtmgrpc.Dtm.Submit:output_type -> google.protobuf.Empty
|
4, // 8: dtmgrpc.Dtm.RegisterXaBranch:input_type -> dtmgrpc.DtmXaBranchRequest
|
||||||
6, // 9: dtmgrpc.Dtm.Prepare:output_type -> google.protobuf.Empty
|
1, // 9: dtmgrpc.Dtm.NewGid:output_type -> dtmgrpc.DtmGidReply
|
||||||
6, // 10: dtmgrpc.Dtm.Abort:output_type -> google.protobuf.Empty
|
7, // 10: dtmgrpc.Dtm.Submit:output_type -> google.protobuf.Empty
|
||||||
6, // 11: dtmgrpc.Dtm.RegisterTccBranch:output_type -> google.protobuf.Empty
|
7, // 11: dtmgrpc.Dtm.Prepare:output_type -> google.protobuf.Empty
|
||||||
6, // 12: dtmgrpc.Dtm.RegisterXaBranch:output_type -> google.protobuf.Empty
|
7, // 12: dtmgrpc.Dtm.Abort:output_type -> google.protobuf.Empty
|
||||||
8, // [8:13] is the sub-list for method output_type
|
7, // 13: dtmgrpc.Dtm.RegisterTccBranch:output_type -> google.protobuf.Empty
|
||||||
3, // [3:8] is the sub-list for method input_type
|
7, // 14: dtmgrpc.Dtm.RegisterXaBranch:output_type -> google.protobuf.Empty
|
||||||
|
9, // [9:15] is the sub-list for method output_type
|
||||||
|
3, // [3:9] is the sub-list for method input_type
|
||||||
3, // [3:3] is the sub-list for extension type_name
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
3, // [3:3] is the sub-list for extension extendee
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
0, // [0:3] is the sub-list for field type_name
|
0, // [0:3] is the sub-list for field type_name
|
||||||
@ -569,7 +624,7 @@ func file_dtmgrpc_dtmgrpc_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_dtmgrpc_dtmgrpc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
file_dtmgrpc_dtmgrpc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*BranchInfo); i {
|
switch v := v.(*DtmGidReply); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -581,7 +636,7 @@ func file_dtmgrpc_dtmgrpc_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_dtmgrpc_dtmgrpc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
file_dtmgrpc_dtmgrpc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*DtmTccBranchRequest); i {
|
switch v := v.(*BranchInfo); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -593,7 +648,7 @@ func file_dtmgrpc_dtmgrpc_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_dtmgrpc_dtmgrpc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
file_dtmgrpc_dtmgrpc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*DtmXaBranchRequest); i {
|
switch v := v.(*DtmTccBranchRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -605,7 +660,7 @@ func file_dtmgrpc_dtmgrpc_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_dtmgrpc_dtmgrpc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
file_dtmgrpc_dtmgrpc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*BusiRequest); i {
|
switch v := v.(*DtmXaBranchRequest); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
@ -617,6 +672,18 @@ func file_dtmgrpc_dtmgrpc_proto_init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
file_dtmgrpc_dtmgrpc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
file_dtmgrpc_dtmgrpc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*BusiRequest); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
file_dtmgrpc_dtmgrpc_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||||
switch v := v.(*BusiReply); i {
|
switch v := v.(*BusiReply); i {
|
||||||
case 0:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
@ -635,7 +702,7 @@ func file_dtmgrpc_dtmgrpc_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_dtmgrpc_dtmgrpc_proto_rawDesc,
|
RawDescriptor: file_dtmgrpc_dtmgrpc_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 6,
|
NumMessages: 7,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -7,6 +7,7 @@ package dtmgrpc;
|
|||||||
|
|
||||||
// The dtm service definition.
|
// The dtm service definition.
|
||||||
service Dtm {
|
service Dtm {
|
||||||
|
rpc NewGid(google.protobuf.Empty) returns (DtmGidReply) {}
|
||||||
rpc Submit(DtmRequest) returns (google.protobuf.Empty) {}
|
rpc Submit(DtmRequest) returns (google.protobuf.Empty) {}
|
||||||
rpc Prepare(DtmRequest) returns (google.protobuf.Empty) {}
|
rpc Prepare(DtmRequest) returns (google.protobuf.Empty) {}
|
||||||
rpc Abort(DtmRequest) returns (google.protobuf.Empty) {}
|
rpc Abort(DtmRequest) returns (google.protobuf.Empty) {}
|
||||||
@ -26,18 +27,9 @@ message DtmRequest {
|
|||||||
string Data = 5;
|
string Data = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
message DtmGidReply {
|
||||||
"gid": t.Gid,
|
string Gid = 1;
|
||||||
"branch_id": branchID,
|
}
|
||||||
"trans_type": "tcc",
|
|
||||||
"status": "prepared",
|
|
||||||
"data": string(MustMarshal(body)),
|
|
||||||
"try": tryURL,
|
|
||||||
"confirm": confirmURL,
|
|
||||||
"cancel": cancelURL,
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// BranchInfo 事务分支信息
|
// BranchInfo 事务分支信息
|
||||||
message BranchInfo {
|
message BranchInfo {
|
||||||
string Gid = 1;
|
string Gid = 1;
|
||||||
|
|||||||
@ -19,6 +19,7 @@ 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.
|
// 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 DtmClient interface {
|
type DtmClient interface {
|
||||||
|
NewGid(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DtmGidReply, error)
|
||||||
Submit(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
Submit(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
Prepare(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
Prepare(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
Abort(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
Abort(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
@ -34,6 +35,15 @@ func NewDtmClient(cc grpc.ClientConnInterface) DtmClient {
|
|||||||
return &dtmClient{cc}
|
return &dtmClient{cc}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *dtmClient) NewGid(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*DtmGidReply, error) {
|
||||||
|
out := new(DtmGidReply)
|
||||||
|
err := c.cc.Invoke(ctx, "/dtmgrpc.Dtm/NewGid", in, out, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *dtmClient) Submit(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
func (c *dtmClient) Submit(ctx context.Context, in *DtmRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||||
out := new(emptypb.Empty)
|
out := new(emptypb.Empty)
|
||||||
err := c.cc.Invoke(ctx, "/dtmgrpc.Dtm/Submit", in, out, opts...)
|
err := c.cc.Invoke(ctx, "/dtmgrpc.Dtm/Submit", in, out, opts...)
|
||||||
@ -83,6 +93,7 @@ func (c *dtmClient) RegisterXaBranch(ctx context.Context, in *DtmXaBranchRequest
|
|||||||
// All implementations must embed UnimplementedDtmServer
|
// All implementations must embed UnimplementedDtmServer
|
||||||
// for forward compatibility
|
// for forward compatibility
|
||||||
type DtmServer interface {
|
type DtmServer interface {
|
||||||
|
NewGid(context.Context, *emptypb.Empty) (*DtmGidReply, error)
|
||||||
Submit(context.Context, *DtmRequest) (*emptypb.Empty, error)
|
Submit(context.Context, *DtmRequest) (*emptypb.Empty, error)
|
||||||
Prepare(context.Context, *DtmRequest) (*emptypb.Empty, error)
|
Prepare(context.Context, *DtmRequest) (*emptypb.Empty, error)
|
||||||
Abort(context.Context, *DtmRequest) (*emptypb.Empty, error)
|
Abort(context.Context, *DtmRequest) (*emptypb.Empty, error)
|
||||||
@ -95,6 +106,9 @@ type DtmServer interface {
|
|||||||
type UnimplementedDtmServer struct {
|
type UnimplementedDtmServer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (UnimplementedDtmServer) NewGid(context.Context, *emptypb.Empty) (*DtmGidReply, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method NewGid not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedDtmServer) Submit(context.Context, *DtmRequest) (*emptypb.Empty, error) {
|
func (UnimplementedDtmServer) Submit(context.Context, *DtmRequest) (*emptypb.Empty, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method Submit not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method Submit not implemented")
|
||||||
}
|
}
|
||||||
@ -123,6 +137,24 @@ func RegisterDtmServer(s grpc.ServiceRegistrar, srv DtmServer) {
|
|||||||
s.RegisterService(&Dtm_ServiceDesc, srv)
|
s.RegisterService(&Dtm_ServiceDesc, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Dtm_NewGid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(emptypb.Empty)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(DtmServer).NewGid(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: "/dtmgrpc.Dtm/NewGid",
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(DtmServer).NewGid(ctx, req.(*emptypb.Empty))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _Dtm_Submit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _Dtm_Submit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(DtmRequest)
|
in := new(DtmRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -220,6 +252,10 @@ var Dtm_ServiceDesc = grpc.ServiceDesc{
|
|||||||
ServiceName: "dtmgrpc.Dtm",
|
ServiceName: "dtmgrpc.Dtm",
|
||||||
HandlerType: (*DtmServer)(nil),
|
HandlerType: (*DtmServer)(nil),
|
||||||
Methods: []grpc.MethodDesc{
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "NewGid",
|
||||||
|
Handler: _Dtm_NewGid_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "Submit",
|
MethodName: "Submit",
|
||||||
Handler: _Dtm_Submit_Handler,
|
Handler: _Dtm_Submit_Handler,
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import (
|
|||||||
grpc "google.golang.org/grpc"
|
grpc "google.golang.org/grpc"
|
||||||
codes "google.golang.org/grpc/codes"
|
codes "google.golang.org/grpc/codes"
|
||||||
status "google.golang.org/grpc/status"
|
status "google.golang.org/grpc/status"
|
||||||
|
"google.golang.org/protobuf/types/known/emptypb"
|
||||||
)
|
)
|
||||||
|
|
||||||
var clients = map[string]*grpc.ClientConn{}
|
var clients = map[string]*grpc.ClientConn{}
|
||||||
@ -39,6 +40,14 @@ func MustGetDtmClient(grpcServer string) DtmClient {
|
|||||||
return NewDtmClient(MustGetGrpcConn(grpcServer))
|
return NewDtmClient(MustGetGrpcConn(grpcServer))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MustGenGid 1
|
||||||
|
func MustGenGid(grpcServer string) string {
|
||||||
|
dc := MustGetDtmClient(grpcServer)
|
||||||
|
r, err := dc.NewGid(context.Background(), &emptypb.Empty{})
|
||||||
|
dtmcli.E2P(err)
|
||||||
|
return r.Gid
|
||||||
|
}
|
||||||
|
|
||||||
// GetServerAndMethod 将grpc的url分解为server和method
|
// GetServerAndMethod 将grpc的url分解为server和method
|
||||||
func GetServerAndMethod(grpcURL string) (string, string) {
|
func GetServerAndMethod(grpcURL string) (string, string) {
|
||||||
fs := strings.Split(grpcURL, "/")
|
fs := strings.Split(grpcURL, "/")
|
||||||
|
|||||||
@ -14,6 +14,10 @@ type dtmServer struct {
|
|||||||
pb.UnimplementedDtmServer
|
pb.UnimplementedDtmServer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *dtmServer) NewGid(ctx context.Context, in *emptypb.Empty) (*dtmgrpc.DtmGidReply, error) {
|
||||||
|
return &dtmgrpc.DtmGidReply{Gid: GenGid()}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *dtmServer) Submit(ctx context.Context, in *pb.DtmRequest) (*emptypb.Empty, error) {
|
func (s *dtmServer) Submit(ctx context.Context, in *pb.DtmRequest) (*emptypb.Empty, error) {
|
||||||
r, err := svcSubmit(TransFromDtmRequest(in), in.WaitResult)
|
r, err := svcSubmit(TransFromDtmRequest(in), in.WaitResult)
|
||||||
return &emptypb.Empty{}, dtmgrpc.Result2Error(r, err)
|
return &emptypb.Empty{}, dtmgrpc.Result2Error(r, err)
|
||||||
|
|||||||
@ -36,3 +36,13 @@ func PopulateDB(skipDrop bool) {
|
|||||||
file = fmt.Sprintf("%s/../dtmcli/barrier.%s.sql", common.GetCurrentCodeDir(), config.DB["driver"])
|
file = fmt.Sprintf("%s/../dtmcli/barrier.%s.sql", common.GetCurrentCodeDir(), config.DB["driver"])
|
||||||
RunSQLScript(config.DB, file, skipDrop)
|
RunSQLScript(config.DB, file, skipDrop)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Samples 所有的示例都会注册到这里
|
||||||
|
var Samples = map[string]func() string{}
|
||||||
|
|
||||||
|
func addSample(name string, fn func() string) {
|
||||||
|
if Samples[name] != nil {
|
||||||
|
dtmcli.LogFatalf("sample %s duplicated", name)
|
||||||
|
}
|
||||||
|
Samples[name] = fn
|
||||||
|
}
|
||||||
|
|||||||
@ -5,13 +5,15 @@ import (
|
|||||||
dtmgrpc "github.com/yedf/dtm/dtmgrpc"
|
dtmgrpc "github.com/yedf/dtm/dtmgrpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MsgGrpcFireRequest 1
|
func init() {
|
||||||
func MsgGrpcFireRequest() string {
|
addSample("grpc_msg", func() string {
|
||||||
req := dtmcli.MustMarshal(&TransReq{Amount: 30})
|
req := dtmcli.MustMarshal(&TransReq{Amount: 30})
|
||||||
msg := dtmgrpc.NewMsgGrpc(DtmGrpcServer, dtmcli.MustGenGid(DtmServer)).
|
gid := dtmgrpc.MustGenGid(DtmGrpcServer)
|
||||||
Add(BusiGrpc+"/examples.Busi/TransOut", req).
|
msg := dtmgrpc.NewMsgGrpc(DtmGrpcServer, gid).
|
||||||
Add(BusiGrpc+"/examples.Busi/TransIn", req)
|
Add(BusiGrpc+"/examples.Busi/TransOut", req).
|
||||||
err := msg.Submit()
|
Add(BusiGrpc+"/examples.Busi/TransIn", req)
|
||||||
dtmcli.FatalIfError(err)
|
err := msg.Submit()
|
||||||
return msg.Gid
|
dtmcli.FatalIfError(err)
|
||||||
|
return msg.Gid
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
19
examples/grpc_saga.go
Normal file
19
examples/grpc_saga.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package examples
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/yedf/dtm/dtmcli"
|
||||||
|
dtmgrpc "github.com/yedf/dtm/dtmgrpc"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
addSample("grpc_saga", func() string {
|
||||||
|
req := dtmcli.MustMarshal(&TransReq{Amount: 30})
|
||||||
|
gid := dtmgrpc.MustGenGid(DtmGrpcServer)
|
||||||
|
msg := dtmgrpc.NewSaga(DtmGrpcServer, gid).
|
||||||
|
Add(BusiGrpc+"/examples.Busi/TransOut", BusiGrpc+"/examples.Busi/TransOutRevert", req).
|
||||||
|
Add(BusiGrpc+"/examples.Busi/TransIn", BusiGrpc+"/examples.Busi/TransOutRevert", req)
|
||||||
|
err := msg.Submit()
|
||||||
|
dtmcli.FatalIfError(err)
|
||||||
|
return msg.Gid
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -16,25 +16,23 @@ func init() {
|
|||||||
setupFuncs["XaGrpcSetup"] = func(app *gin.Engine) {
|
setupFuncs["XaGrpcSetup"] = func(app *gin.Engine) {
|
||||||
XaGrpcClient = dtmgrpc.NewXaGrpcClient(DtmGrpcServer, config.DB, BusiGrpc+"/examples.Busi/XaNotify")
|
XaGrpcClient = dtmgrpc.NewXaGrpcClient(DtmGrpcServer, config.DB, BusiGrpc+"/examples.Busi/XaNotify")
|
||||||
}
|
}
|
||||||
|
addSample("grpc_xa", func() string {
|
||||||
|
gid := dtmgrpc.MustGenGid(DtmGrpcServer)
|
||||||
|
busiData := dtmcli.MustMarshal(&TransReq{Amount: 30})
|
||||||
|
err := XaGrpcClient.XaGlobalTransaction(gid, func(xa *dtmgrpc.XaGrpc) error {
|
||||||
|
_, err := xa.CallBranch(busiData, BusiGrpc+"/examples.Busi/TransOutXa")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = xa.CallBranch(busiData, BusiGrpc+"/examples.Busi/TransInXa")
|
||||||
|
return err
|
||||||
|
})
|
||||||
|
dtmcli.FatalIfError(err)
|
||||||
|
return gid
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *busiServer) XaNotify(ctx context.Context, in *dtmgrpc.BusiRequest) (*emptypb.Empty, error) {
|
func (s *busiServer) XaNotify(ctx context.Context, in *dtmgrpc.BusiRequest) (*emptypb.Empty, error) {
|
||||||
err := XaGrpcClient.HandleCallback(in.Info.Gid, in.Info.BranchID, in.Info.BranchType)
|
err := XaGrpcClient.HandleCallback(in.Info.Gid, in.Info.BranchID, in.Info.BranchType)
|
||||||
return &emptypb.Empty{}, dtmgrpc.Result2Error(nil, err)
|
return &emptypb.Empty{}, dtmgrpc.Result2Error(nil, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// XaGrpcFireRequest 注册全局XA事务,调用XA的分支
|
|
||||||
func XaGrpcFireRequest() string {
|
|
||||||
gid := dtmcli.MustGenGid(DtmServer)
|
|
||||||
busiData := dtmcli.MustMarshal(&TransReq{Amount: 30})
|
|
||||||
err := XaGrpcClient.XaGlobalTransaction(gid, func(xa *dtmgrpc.XaGrpc) error {
|
|
||||||
_, err := xa.CallBranch(busiData, BusiGrpc+"/examples.Busi/TransOutXa")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
_, err = xa.CallBranch(busiData, BusiGrpc+"/examples.Busi/TransInXa")
|
|
||||||
return err
|
|
||||||
})
|
|
||||||
dtmcli.FatalIfError(err)
|
|
||||||
return gid
|
|
||||||
}
|
|
||||||
|
|||||||
@ -4,17 +4,18 @@ import (
|
|||||||
"github.com/yedf/dtm/dtmcli"
|
"github.com/yedf/dtm/dtmcli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MsgFireRequest 1
|
func init() {
|
||||||
func MsgFireRequest() string {
|
addSample("msg", func() string {
|
||||||
dtmcli.Logf("a busi transaction begin")
|
dtmcli.Logf("a busi transaction begin")
|
||||||
req := &TransReq{Amount: 30}
|
req := &TransReq{Amount: 30}
|
||||||
msg := dtmcli.NewMsg(DtmServer, dtmcli.MustGenGid(DtmServer)).
|
msg := dtmcli.NewMsg(DtmServer, dtmcli.MustGenGid(DtmServer)).
|
||||||
Add(Busi+"/TransOut", req).
|
Add(Busi+"/TransOut", req).
|
||||||
Add(Busi+"/TransIn", req)
|
Add(Busi+"/TransIn", req)
|
||||||
err := msg.Prepare(Busi + "/TransQuery")
|
err := msg.Prepare(Busi + "/TransQuery")
|
||||||
dtmcli.FatalIfError(err)
|
dtmcli.FatalIfError(err)
|
||||||
dtmcli.Logf("busi trans submit")
|
dtmcli.Logf("busi trans submit")
|
||||||
err = msg.Submit()
|
err = msg.Submit()
|
||||||
dtmcli.FatalIfError(err)
|
dtmcli.FatalIfError(err)
|
||||||
return msg.Gid
|
return msg.Gid
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,20 +4,21 @@ import (
|
|||||||
"github.com/yedf/dtm/dtmcli"
|
"github.com/yedf/dtm/dtmcli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SagaFireRequest 1
|
func init() {
|
||||||
func SagaFireRequest() string {
|
addSample("saga", func() string {
|
||||||
dtmcli.Logf("a saga busi transaction begin")
|
dtmcli.Logf("a saga busi transaction begin")
|
||||||
req := &TransReq{
|
req := &TransReq{
|
||||||
Amount: 30,
|
Amount: 30,
|
||||||
TransInResult: "SUCCESS",
|
TransInResult: "SUCCESS",
|
||||||
TransOutResult: "SUCCESS",
|
TransOutResult: "SUCCESS",
|
||||||
}
|
}
|
||||||
saga := dtmcli.NewSaga(DtmServer, dtmcli.MustGenGid(DtmServer)).
|
saga := dtmcli.NewSaga(DtmServer, dtmcli.MustGenGid(DtmServer)).
|
||||||
Add(Busi+"/TransOut", Busi+"/TransOutRevert", req).
|
Add(Busi+"/TransOut", Busi+"/TransOutRevert", req).
|
||||||
Add(Busi+"/TransIn", Busi+"/TransInRevert", req)
|
Add(Busi+"/TransIn", Busi+"/TransInRevert", req)
|
||||||
dtmcli.Logf("saga busi trans submit")
|
dtmcli.Logf("saga busi trans submit")
|
||||||
err := saga.Submit()
|
err := saga.Submit()
|
||||||
dtmcli.Logf("result gid is: %s", saga.Gid)
|
dtmcli.Logf("result gid is: %s", saga.Gid)
|
||||||
dtmcli.FatalIfError(err)
|
dtmcli.FatalIfError(err)
|
||||||
return saga.Gid
|
return saga.Gid
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,19 +8,6 @@ import (
|
|||||||
"github.com/yedf/dtm/dtmcli"
|
"github.com/yedf/dtm/dtmcli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SagaBarrierFireRequest 1
|
|
||||||
func SagaBarrierFireRequest() string {
|
|
||||||
dtmcli.Logf("a busi transaction begin")
|
|
||||||
req := &TransReq{Amount: 30}
|
|
||||||
saga := dtmcli.NewSaga(DtmServer, dtmcli.MustGenGid(DtmServer)).
|
|
||||||
Add(Busi+"/SagaBTransOut", Busi+"/SagaBTransOutCompensate", req).
|
|
||||||
Add(Busi+"/SagaBTransIn", Busi+"/SagaBTransInCompensate", req)
|
|
||||||
dtmcli.Logf("busi trans submit")
|
|
||||||
err := saga.Submit()
|
|
||||||
dtmcli.FatalIfError(err)
|
|
||||||
return saga.Gid
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
setupFuncs["SagaBarrierSetup"] = func(app *gin.Engine) {
|
setupFuncs["SagaBarrierSetup"] = func(app *gin.Engine) {
|
||||||
app.POST(BusiAPI+"/SagaBTransIn", common.WrapHandler(sagaBarrierTransIn))
|
app.POST(BusiAPI+"/SagaBTransIn", common.WrapHandler(sagaBarrierTransIn))
|
||||||
@ -29,6 +16,17 @@ func init() {
|
|||||||
app.POST(BusiAPI+"/SagaBTransOutCompensate", common.WrapHandler(sagaBarrierTransOutCompensate))
|
app.POST(BusiAPI+"/SagaBTransOutCompensate", common.WrapHandler(sagaBarrierTransOutCompensate))
|
||||||
dtmcli.Logf("examples listening at %d", BusiPort)
|
dtmcli.Logf("examples listening at %d", BusiPort)
|
||||||
}
|
}
|
||||||
|
addSample("saga_barrier", func() string {
|
||||||
|
dtmcli.Logf("a busi transaction begin")
|
||||||
|
req := &TransReq{Amount: 30}
|
||||||
|
saga := dtmcli.NewSaga(DtmServer, dtmcli.MustGenGid(DtmServer)).
|
||||||
|
Add(Busi+"/SagaBTransOut", Busi+"/SagaBTransOutCompensate", req).
|
||||||
|
Add(Busi+"/SagaBTransIn", Busi+"/SagaBTransInCompensate", req)
|
||||||
|
dtmcli.Logf("busi trans submit")
|
||||||
|
err := saga.Submit()
|
||||||
|
dtmcli.FatalIfError(err)
|
||||||
|
return saga.Gid
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func sagaBarrierAdjustBalance(sdb *sql.Tx, uid int, amount int) (interface{}, error) {
|
func sagaBarrierAdjustBalance(sdb *sql.Tx, uid int, amount int) (interface{}, error) {
|
||||||
|
|||||||
@ -4,20 +4,21 @@ import (
|
|||||||
"github.com/yedf/dtm/dtmcli"
|
"github.com/yedf/dtm/dtmcli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SagaWaitFireRequest 1
|
func init() {
|
||||||
func SagaWaitFireRequest() string {
|
addSample("saga_wait", func() string {
|
||||||
dtmcli.Logf("a saga busi transaction begin")
|
dtmcli.Logf("a saga busi transaction begin")
|
||||||
req := &TransReq{
|
req := &TransReq{
|
||||||
Amount: 30,
|
Amount: 30,
|
||||||
TransInResult: "SUCCESS",
|
TransInResult: "SUCCESS",
|
||||||
TransOutResult: "SUCCESS",
|
TransOutResult: "SUCCESS",
|
||||||
}
|
}
|
||||||
saga := dtmcli.NewSaga(DtmServer, dtmcli.MustGenGid(DtmServer)).
|
saga := dtmcli.NewSaga(DtmServer, dtmcli.MustGenGid(DtmServer)).
|
||||||
Add(Busi+"/TransOut", Busi+"/TransOutRevert", req).
|
Add(Busi+"/TransOut", Busi+"/TransOutRevert", req).
|
||||||
Add(Busi+"/TransIn", Busi+"/TransInRevert", req)
|
Add(Busi+"/TransIn", Busi+"/TransInRevert", req)
|
||||||
saga.WaitResult = true // 设置为等待结果模式,后面的submit调用,会等待服务器处理这个事务。如果Submit正常返回,那么整个全局事务已成功完成
|
saga.WaitResult = true // 设置为等待结果模式,后面的submit调用,会等待服务器处理这个事务。如果Submit正常返回,那么整个全局事务已成功完成
|
||||||
err := saga.Submit()
|
err := saga.Submit()
|
||||||
dtmcli.Logf("result gid is: %s", saga.Gid)
|
dtmcli.Logf("result gid is: %s", saga.Gid)
|
||||||
dtmcli.FatalIfError(err)
|
dtmcli.FatalIfError(err)
|
||||||
return saga.Gid
|
return saga.Gid
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,33 +16,29 @@ func init() {
|
|||||||
return tcc.CallBranch(&TransReq{Amount: reqFrom(c).Amount}, Busi+"/TransIn", Busi+"/TransInConfirm", Busi+"/TransInRevert")
|
return tcc.CallBranch(&TransReq{Amount: reqFrom(c).Amount}, Busi+"/TransIn", Busi+"/TransInConfirm", Busi+"/TransInRevert")
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
addSample("tcc_nested", func() string {
|
||||||
|
gid := dtmcli.MustGenGid(DtmServer)
|
||||||
// TccFireRequestNested 1
|
err := dtmcli.TccGlobalTransaction(DtmServer, gid, func(tcc *dtmcli.Tcc) (*resty.Response, error) {
|
||||||
func TccFireRequestNested() string {
|
resp, err := tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TransOut", Busi+"/TransOutConfirm", Busi+"/TransOutRevert")
|
||||||
gid := dtmcli.MustGenGid(DtmServer)
|
if err != nil {
|
||||||
err := dtmcli.TccGlobalTransaction(DtmServer, gid, func(tcc *dtmcli.Tcc) (*resty.Response, error) {
|
return resp, err
|
||||||
resp, err := tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TransOut", Busi+"/TransOutConfirm", Busi+"/TransOutRevert")
|
}
|
||||||
if err != nil {
|
return tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TransInTccParent", Busi+"/TransInConfirm", Busi+"/TransInRevert")
|
||||||
return resp, err
|
})
|
||||||
}
|
dtmcli.FatalIfError(err)
|
||||||
return tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TransInTccParent", Busi+"/TransInConfirm", Busi+"/TransInRevert")
|
return gid
|
||||||
})
|
})
|
||||||
dtmcli.FatalIfError(err)
|
addSample("tcc", func() string {
|
||||||
return gid
|
dtmcli.Logf("tcc simple transaction begin")
|
||||||
}
|
gid := dtmcli.MustGenGid(DtmServer)
|
||||||
|
err := dtmcli.TccGlobalTransaction(DtmServer, gid, func(tcc *dtmcli.Tcc) (*resty.Response, error) {
|
||||||
// TccFireRequest 1
|
resp, err := tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TransOut", Busi+"/TransOutConfirm", Busi+"/TransOutRevert")
|
||||||
func TccFireRequest() string {
|
if err != nil {
|
||||||
dtmcli.Logf("tcc simple transaction begin")
|
return resp, err
|
||||||
gid := dtmcli.MustGenGid(DtmServer)
|
}
|
||||||
err := dtmcli.TccGlobalTransaction(DtmServer, gid, func(tcc *dtmcli.Tcc) (*resty.Response, error) {
|
return tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TransIn", Busi+"/TransInConfirm", Busi+"/TransInRevert")
|
||||||
resp, err := tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TransOut", Busi+"/TransOutConfirm", Busi+"/TransOutRevert")
|
})
|
||||||
if err != nil {
|
dtmcli.FatalIfError(err)
|
||||||
return resp, err
|
return gid
|
||||||
}
|
|
||||||
return tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TransIn", Busi+"/TransInConfirm", Busi+"/TransInRevert")
|
|
||||||
})
|
})
|
||||||
dtmcli.FatalIfError(err)
|
|
||||||
return gid
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,21 +10,6 @@ import (
|
|||||||
"github.com/yedf/dtm/dtmcli"
|
"github.com/yedf/dtm/dtmcli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TccBarrierFireRequest 1
|
|
||||||
func TccBarrierFireRequest() string {
|
|
||||||
dtmcli.Logf("tcc transaction begin")
|
|
||||||
gid := dtmcli.MustGenGid(DtmServer)
|
|
||||||
err := dtmcli.TccGlobalTransaction(DtmServer, gid, func(tcc *dtmcli.Tcc) (*resty.Response, error) {
|
|
||||||
resp, err := tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TccBTransOutTry", Busi+"/TccBTransOutConfirm", Busi+"/TccBTransOutCancel")
|
|
||||||
if err != nil {
|
|
||||||
return resp, err
|
|
||||||
}
|
|
||||||
return tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TccBTransInTry", Busi+"/TccBTransInConfirm", Busi+"/TccBTransInCancel")
|
|
||||||
})
|
|
||||||
dtmcli.FatalIfError(err)
|
|
||||||
return gid
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
setupFuncs["TccBarrierSetup"] = func(app *gin.Engine) {
|
setupFuncs["TccBarrierSetup"] = func(app *gin.Engine) {
|
||||||
app.POST(BusiAPI+"/TccBTransInTry", common.WrapHandler(tccBarrierTransInTry))
|
app.POST(BusiAPI+"/TccBTransInTry", common.WrapHandler(tccBarrierTransInTry))
|
||||||
@ -35,6 +20,19 @@ func init() {
|
|||||||
app.POST(BusiAPI+"/TccBTransOutCancel", common.WrapHandler(TccBarrierTransOutCancel))
|
app.POST(BusiAPI+"/TccBTransOutCancel", common.WrapHandler(TccBarrierTransOutCancel))
|
||||||
dtmcli.Logf("examples listening at %d", BusiPort)
|
dtmcli.Logf("examples listening at %d", BusiPort)
|
||||||
}
|
}
|
||||||
|
addSample("tcc_barrier", func() string {
|
||||||
|
dtmcli.Logf("tcc transaction begin")
|
||||||
|
gid := dtmcli.MustGenGid(DtmServer)
|
||||||
|
err := dtmcli.TccGlobalTransaction(DtmServer, gid, func(tcc *dtmcli.Tcc) (*resty.Response, error) {
|
||||||
|
resp, err := tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TccBTransOutTry", Busi+"/TccBTransOutConfirm", Busi+"/TccBTransOutCancel")
|
||||||
|
if err != nil {
|
||||||
|
return resp, err
|
||||||
|
}
|
||||||
|
return tcc.CallBranch(&TransReq{Amount: 30}, Busi+"/TccBTransInTry", Busi+"/TccBTransInConfirm", Busi+"/TccBTransInCancel")
|
||||||
|
})
|
||||||
|
dtmcli.FatalIfError(err)
|
||||||
|
return gid
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const transInUID = 1
|
const transInUID = 1
|
||||||
|
|||||||
@ -20,18 +20,16 @@ func init() {
|
|||||||
})
|
})
|
||||||
dtmcli.FatalIfError(err)
|
dtmcli.FatalIfError(err)
|
||||||
}
|
}
|
||||||
}
|
addSample("xa", func() string {
|
||||||
|
gid := dtmcli.MustGenGid(DtmServer)
|
||||||
// XaFireRequest 注册全局XA事务,调用XA的分支
|
err := XaClient.XaGlobalTransaction(gid, func(xa *dtmcli.Xa) (*resty.Response, error) {
|
||||||
func XaFireRequest() string {
|
resp, err := xa.CallBranch(&TransReq{Amount: 30}, Busi+"/TransOutXa")
|
||||||
gid := dtmcli.MustGenGid(DtmServer)
|
if err != nil {
|
||||||
err := XaClient.XaGlobalTransaction(gid, func(xa *dtmcli.Xa) (*resty.Response, error) {
|
return resp, err
|
||||||
resp, err := xa.CallBranch(&TransReq{Amount: 30}, Busi+"/TransOutXa")
|
}
|
||||||
if err != nil {
|
return xa.CallBranch(&TransReq{Amount: 30}, Busi+"/TransInXa")
|
||||||
return resp, err
|
})
|
||||||
}
|
dtmcli.FatalIfError(err)
|
||||||
return xa.CallBranch(&TransReq{Amount: 30}, Busi+"/TransInXa")
|
return gid
|
||||||
})
|
})
|
||||||
dtmcli.FatalIfError(err)
|
|
||||||
return gid
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,15 +9,7 @@ import (
|
|||||||
func TestExamples(t *testing.T) {
|
func TestExamples(t *testing.T) {
|
||||||
// for coverage
|
// for coverage
|
||||||
examples.QsStartSvr()
|
examples.QsStartSvr()
|
||||||
assertSucceed(t, examples.QsFireRequest())
|
for _, fn := range examples.Samples {
|
||||||
assertSucceed(t, examples.MsgFireRequest())
|
assertSucceed(t, fn())
|
||||||
assertSucceed(t, examples.SagaBarrierFireRequest())
|
}
|
||||||
assertSucceed(t, examples.SagaFireRequest())
|
|
||||||
assertSucceed(t, examples.SagaWaitFireRequest())
|
|
||||||
assertSucceed(t, examples.TccBarrierFireRequest())
|
|
||||||
assertSucceed(t, examples.TccFireRequest())
|
|
||||||
assertSucceed(t, examples.TccFireRequestNested())
|
|
||||||
assertSucceed(t, examples.XaFireRequest())
|
|
||||||
assertSucceed(t, examples.MsgGrpcFireRequest())
|
|
||||||
assertSucceed(t, examples.GrpcSagaFireRequest())
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user