74 lines
1.9 KiB
Protocol Buffer
74 lines
1.9 KiB
Protocol Buffer
syntax = "proto3";
|
||
|
||
option go_package = "github.com/yedf/dtm/dtmgrpc";
|
||
import "google/protobuf/empty.proto";
|
||
|
||
package dtmgrpc;
|
||
|
||
// The dtm service definition.
|
||
service Dtm {
|
||
rpc Submit(DtmRequest) returns (google.protobuf.Empty) {}
|
||
rpc Prepare(DtmRequest) returns (google.protobuf.Empty) {}
|
||
rpc Abort(DtmRequest) returns (google.protobuf.Empty) {}
|
||
rpc RegisterTccBranch(DtmTccBranchRequest) returns (google.protobuf.Empty) {}
|
||
rpc RegisterXaBranch(DtmXaBranchRequest) returns (google.protobuf.Empty) {}
|
||
}
|
||
|
||
// DtmRequest 发给dtm服务器的消息,响应为Emtpy,error == nil为成功,== Aborted 为失败 == 其他 可以重试
|
||
message DtmRequest {
|
||
string Gid = 1;
|
||
string TransType = 2;
|
||
// QueryPrepared 对于事务消息处于prepared状态过期,责护查询QueryPrepared
|
||
string QueryPrepared = 3;
|
||
// WaitResult 设定这个值,Submit操作会等待dtm处理一次请求,可能在返回时,就可以把分布式事务完成
|
||
bool WaitResult = 4;
|
||
// Data 包含saga、msg的子事务信息
|
||
string Data = 5;
|
||
}
|
||
|
||
/*
|
||
"gid": t.Gid,
|
||
"branch_id": branchID,
|
||
"trans_type": "tcc",
|
||
"status": "prepared",
|
||
"data": string(MustMarshal(body)),
|
||
"try": tryURL,
|
||
"confirm": confirmURL,
|
||
"cancel": cancelURL,
|
||
|
||
*/
|
||
|
||
// BranchInfo 事务分支信息
|
||
message BranchInfo {
|
||
string Gid = 1;
|
||
string TransType = 2;
|
||
string BranchID = 3;
|
||
string BranchType = 4;
|
||
}
|
||
|
||
message DtmTccBranchRequest {
|
||
BranchInfo Info = 1;
|
||
string BusiData = 2;
|
||
string Try = 3;
|
||
string Confirm = 4;
|
||
string Cancel = 5;
|
||
}
|
||
|
||
message DtmXaBranchRequest {
|
||
BranchInfo Info = 1;
|
||
string BusiData = 2;
|
||
// dtm通知业务提交和回滚的地址
|
||
string Notify = 3;
|
||
}
|
||
|
||
// BusiRequest 请求业务的数据,需要携带事务信息,便于业务进行幂等处理
|
||
message BusiRequest {
|
||
BranchInfo Info = 1;
|
||
string Dtm = 2;
|
||
bytes BusiData = 3;
|
||
}
|
||
|
||
// BusiReply 业务响应数据
|
||
message BusiReply {
|
||
bytes BusiData = 1;
|
||
} |