From 6f42a3c1cf2ada6fbbfb5e33b1d11aca1e2ffec6 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Sun, 17 Apr 2022 17:38:52 +0800 Subject: [PATCH] rename Ctx => Context --- dtmcli/dtmimp/trans_base.go | 4 ++-- dtmgrpc/dtmgimp/types.go | 2 +- dtmgrpc/dtmgimp/utils.go | 2 +- dtmsvr/trans_class.go | 2 +- dtmsvr/trans_status.go | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dtmcli/dtmimp/trans_base.go b/dtmcli/dtmimp/trans_base.go index dc0c370..876bf55 100644 --- a/dtmcli/dtmimp/trans_base.go +++ b/dtmcli/dtmimp/trans_base.go @@ -59,7 +59,7 @@ type TransBase struct { Dtm string `json:"-"` CustomData string `json:"custom_data,omitempty"` // nosql data persistence TransOptions - Ctx context.Context `json:"-" gorm:"-"` + Context context.Context `json:"-" gorm:"-"` Steps []map[string]string `json:"steps,omitempty"` // use in MSG/SAGA Payloads []string `json:"payloads,omitempty"` // used in MSG/SAGA @@ -79,7 +79,7 @@ func NewTransBase(gid string, transType string, dtm string, branchID string) *Tr BranchIDGen: BranchIDGen{BranchID: branchID}, Dtm: dtm, TransOptions: TransOptions{PassthroughHeaders: PassthroughHeaders}, - Ctx: context.Background(), + Context: context.Background(), } } diff --git a/dtmgrpc/dtmgimp/types.go b/dtmgrpc/dtmgimp/types.go index f5b6fc8..bf17182 100644 --- a/dtmgrpc/dtmgimp/types.go +++ b/dtmgrpc/dtmgimp/types.go @@ -56,7 +56,7 @@ func InvokeBranch(t *dtmimp.TransBase, isRaw bool, msg proto.Message, url string if err != nil { return err } - ctx := TransInfo2Ctx(t.Ctx, t.Gid, t.TransType, branchID, op, t.Dtm) + ctx := TransInfo2Ctx(t.Context, t.Gid, t.TransType, branchID, op, t.Dtm) ctx = metadata.AppendToOutgoingContext(ctx, Map2Kvs(t.BranchHeaders)...) if t.TransType == "xa" { // xa branch need additional phase2_url ctx = metadata.AppendToOutgoingContext(ctx, Map2Kvs(map[string]string{dtmpre + "phase2_url": url})...) diff --git a/dtmgrpc/dtmgimp/utils.go b/dtmgrpc/dtmgimp/utils.go index dd731f1..d10b321 100644 --- a/dtmgrpc/dtmgimp/utils.go +++ b/dtmgrpc/dtmgimp/utils.go @@ -27,7 +27,7 @@ func MustProtoMarshal(msg proto.Message) []byte { // DtmGrpcCall make a convenient call to dtm func DtmGrpcCall(s *dtmimp.TransBase, operation string) error { reply := emptypb.Empty{} - return MustGetGrpcConn(s.Dtm, false).Invoke(s.Ctx, "/dtmgimp.Dtm/"+operation, &dtmgpb.DtmRequest{ + return MustGetGrpcConn(s.Dtm, false).Invoke(s.Context, "/dtmgimp.Dtm/"+operation, &dtmgpb.DtmRequest{ Gid: s.Gid, TransType: s.TransType, TransOptions: &dtmgpb.DtmTransOptions{ diff --git a/dtmsvr/trans_class.go b/dtmsvr/trans_class.go index b5ccc0f..1e239c0 100644 --- a/dtmsvr/trans_class.go +++ b/dtmsvr/trans_class.go @@ -16,7 +16,7 @@ import ( // TransGlobal global transaction type TransGlobal struct { storage.TransGlobalStore - Ctx context.Context + Context context.Context lastTouched time.Time // record the start time of process updateBranchSync bool } diff --git a/dtmsvr/trans_status.go b/dtmsvr/trans_status.go index 286aff3..2ab720f 100644 --- a/dtmsvr/trans_status.go +++ b/dtmsvr/trans_status.go @@ -154,7 +154,7 @@ func (t *TransGlobal) getURLResult(uri string, branchID, op string, branchPayloa } conn := dtmgimp.MustGetGrpcConn(server, true) - ctx := dtmgimp.TransInfo2Ctx(t.Ctx, t.Gid, t.TransType, branchID, op, "") + ctx := dtmgimp.TransInfo2Ctx(t.Context, t.Gid, t.TransType, branchID, op, "") kvs := dtmgimp.Map2Kvs(t.Ext.Headers) kvs = append(kvs, dtmgimp.Map2Kvs(t.BranchHeaders)...) ctx = metadata.AppendToOutgoingContext(ctx, kvs...)