Browse Source

Merge pull request #43 from wuqinqiang/main

modify some notes
pull/46/head
yedf2 4 years ago
committed by GitHub
parent
commit
5c8ade7eea
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      dtmcli/barrier.go
  2. 2
      dtmsvr/api_grpc.go
  3. 2
      examples/base_grpc.go

3
dtmcli/barrier.go

@ -50,7 +50,7 @@ func insertBarrier(tx Tx, transType string, gid string, branchID string, branchT
// Call 子事务屏障,详细介绍见 https://zhuanlan.zhihu.com/p/388444465
// tx: 本地数据库的事务对象,允许子事务屏障进行事务操作
// bisiCall: 业务函数,仅在必要时被调用
// busiCall: 业务函数,仅在必要时被调用
func (bb *BranchBarrier) Call(tx Tx, busiCall BusiFunc) (rerr error) {
bb.BarrierID = bb.BarrierID + 1
bid := fmt.Sprintf("%02d", bb.BarrierID)
@ -70,6 +70,7 @@ func (bb *BranchBarrier) Call(tx Tx, busiCall BusiFunc) (rerr error) {
BranchCancel: BranchTry,
BranchCompensate: BranchAction,
}[ti.BranchType]
originAffected, _ := insertBarrier(tx, ti.TransType, ti.Gid, ti.BranchID, originType, bid, ti.BranchType)
currentAffected, rerr := insertBarrier(tx, ti.TransType, ti.Gid, ti.BranchID, ti.BranchType, bid, ti.BranchType)
Logf("originAffected: %d currentAffected: %d", originAffected, currentAffected)

2
dtmsvr/api_grpc.go

@ -9,7 +9,7 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)
// dtmServer is used to implement helloworld.GreeterServer.
// dtmServer is used to implement dtmgrpc.DtmServer.
type dtmServer struct {
pb.UnimplementedDtmServer
}

2
examples/base_grpc.go

@ -50,7 +50,7 @@ func handleGrpcBusiness(in *dtmgrpc.BusiRequest, result1 string, result2 string,
return status.New(codes.Internal, fmt.Sprintf("unknow result %s", res)).Err()
}
// busiServer is used to implement helloworld.GreeterServer.
// busiServer is used to implement examples.BusiServer.
type busiServer struct {
UnimplementedBusiServer
}

Loading…
Cancel
Save