dtmgimp

package
v1.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2022 License: BSD-3-Clause Imports: 15 Imported by: 2

README

Notice

Please donot use this package, and this package should only be used in dtm internally. The interfaces are not stable, and package name has postfix "imp"

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientInterceptors = []grpc.UnaryClientInterceptor{}

ClientInterceptors declares grpc.UnaryClientInterceptors slice

Functions

func DtmGrpcCall

func DtmGrpcCall(s *dtmimp.TransBase, operation string) error

DtmGrpcCall make a convenient call to dtm

func GetDtmMetaFromContext added in v1.13.0

func GetDtmMetaFromContext(ctx context.Context, name string) string

GetDtmMetaFromContext get dtm header from context

func GetDtmRequest added in v1.15.0

func GetDtmRequest(s *dtmimp.TransBase) *dtmgpb.DtmRequest

GetDtmRequest return a DtmRequest from TransBase

func GetGrpcConn

func GetGrpcConn(grpcServer string, isRaw bool) (conn *grpc.ClientConn, rerr error)

GetGrpcConn 1

func GetMetaFromContext added in v1.8.2

func GetMetaFromContext(ctx context.Context, name string) string

GetMetaFromContext get header from context

func GrpcClientLog

func GrpcClientLog(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error

GrpcClientLog middleware to print client-side grpc log

func GrpcServerLog

func GrpcServerLog(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

GrpcServerLog middleware to print server-side grpc log

func InvokeBranch added in v1.11.1

func InvokeBranch(t *dtmimp.TransBase, isRaw bool, msg proto.Message, url string, reply interface{}, branchID string, op string) error

InvokeBranch invoke a url for trans

func LogDtmCtx

func LogDtmCtx(ctx context.Context)

LogDtmCtx logout dtm info in context metadata

func Map2Kvs added in v1.8.4

func Map2Kvs(m map[string]string) []string

Map2Kvs map to metadata kv

func MustGetDtmClient

func MustGetDtmClient(grpcServer string) dtmgpb.DtmClient

MustGetDtmClient 1

func MustGetGrpcConn

func MustGetGrpcConn(grpcServer string, isRaw bool) *grpc.ClientConn

MustGetGrpcConn 1

func MustProtoMarshal

func MustProtoMarshal(msg proto.Message) []byte

MustProtoMarshal must version of proto.Marshal

func MustProtoUnmarshal added in v1.15.0

func MustProtoUnmarshal(data []byte, msg proto.Message)

MustProtoUnmarshal must version of proto.Unmarshal

func RequestTimeoutFromContext added in v1.13.0

func RequestTimeoutFromContext(ctx context.Context) int64

RequestTimeoutFromContext returns requestTime of transOption option

func RequestTimeoutNewContext added in v1.13.0

func RequestTimeoutNewContext(ctx context.Context, requestTimeout int64) context.Context

RequestTimeoutNewContext sets requestTimeout of transOption option to context

func TransBaseFromGrpc

func TransBaseFromGrpc(ctx context.Context) *dtmimp.TransBase

TransBaseFromGrpc get trans base info from a context metadata

func TransInfo2Ctx

func TransInfo2Ctx(ctx context.Context, gid, transType, branchID, op, dtm string) context.Context

TransInfo2Ctx add trans info to grpc context

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL