dtm/dtmgrpc/dtmgrpc.proto
2021-08-10 17:02:40 +08:00

74 lines
1.9 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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服务器的消息响应为Emtpyerror == 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;
}