Browse Source

rename Ctx => Context

pull/273/head
yedf2 4 years ago
parent
commit
6f42a3c1cf
  1. 4
      dtmcli/dtmimp/trans_base.go
  2. 2
      dtmgrpc/dtmgimp/types.go
  3. 2
      dtmgrpc/dtmgimp/utils.go
  4. 2
      dtmsvr/trans_class.go
  5. 2
      dtmsvr/trans_status.go

4
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(),
}
}

2
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})...)

2
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{

2
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
}

2
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...)

Loading…
Cancel
Save