Documentation ¶
Index ¶
- func AddUnaryInterceptor(interceptor grpc.UnaryClientInterceptor)
- func BarrierFromGrpc(ctx context.Context) (*dtmcli.BranchBarrier, error)
- func DtmError2GrpcError(res interface{}) error
- func GrpcError2DtmError(err error) error
- func MustGenGid(grpcServer string) string
- func TccGlobalTransaction(dtm string, gid string, tccFunc TccGlobalFunc) (rerr error)
- func TccGlobalTransaction2(dtm string, gid string, custom func(*TccGrpc), tccFunc TccGlobalFunc) (rerr error)
- func UseDriver(driverName string) error
- func XaGlobalTransaction(server string, gid string, xaFunc XaGrpcGlobalFunc) error
- func XaGlobalTransaction2(server string, gid string, custom func(*XaGrpc), xaFunc XaGrpcGlobalFunc) error
- func XaLocalTransaction(ctx context.Context, dbConf dtmcli.DBConf, xaFunc XaGrpcLocalFunc) error
- type MsgGrpc
- func (s *MsgGrpc) Add(action string, msg proto.Message) *MsgGrpc
- func (s *MsgGrpc) AddTopic(topic string, msg proto.Message) *MsgGrpc
- func (s *MsgGrpc) DoAndSubmit(queryPrepared string, busiCall func(bb *dtmcli.BranchBarrier) error, ...) error
- func (s *MsgGrpc) DoAndSubmitDB(queryPrepared string, db *sql.DB, busiCall dtmcli.BarrierBusiFunc) error
- func (s *MsgGrpc) Prepare(queryPrepared string) error
- func (s *MsgGrpc) SetDelay(delay uint64) *MsgGrpc
- func (s *MsgGrpc) Submit() error
- type SagaGrpc
- type TccGlobalFunc
- type TccGrpc
- type TransBaseOption
- type XaGrpc
- type XaGrpcGlobalFunc
- type XaGrpcLocalFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddUnaryInterceptor ¶
func AddUnaryInterceptor(interceptor grpc.UnaryClientInterceptor)
AddUnaryInterceptor adds grpc.UnaryClientInterceptor
func BarrierFromGrpc ¶
func BarrierFromGrpc(ctx context.Context) (*dtmcli.BranchBarrier, error)
BarrierFromGrpc generate a Barrier from grpc context
func DtmError2GrpcError ¶
func DtmError2GrpcError(res interface{}) error
DtmError2GrpcError translate dtm error to grpc error
func GrpcError2DtmError ¶
GrpcError2DtmError translate grpc error to dtm error
func MustGenGid ¶
MustGenGid must gen a gid from grpcServer
func TccGlobalTransaction ¶
func TccGlobalTransaction(dtm string, gid string, tccFunc TccGlobalFunc) (rerr error)
TccGlobalTransaction begin a tcc global transaction dtm dtm server url gid global transaction id tccFunc tcc busi func, define the transaction logic
func TccGlobalTransaction2 ¶
func TccGlobalTransaction2(dtm string, gid string, custom func(*TccGrpc), tccFunc TccGlobalFunc) (rerr error)
TccGlobalTransaction2 new version of TccGlobalTransaction
func XaGlobalTransaction ¶
func XaGlobalTransaction(server string, gid string, xaFunc XaGrpcGlobalFunc) error
XaGlobalTransaction start a xa global transaction
func XaGlobalTransaction2 ¶
func XaGlobalTransaction2(server string, gid string, custom func(*XaGrpc), xaFunc XaGrpcGlobalFunc) error
XaGlobalTransaction2 new version of XaGlobalTransaction. support custom
func XaLocalTransaction ¶
XaLocalTransaction start a xa local transaction
Types ¶
type MsgGrpc ¶
MsgGrpc reliable msg type
func NewMsgGrpc ¶
func NewMsgGrpc(server string, gid string, opts ...TransBaseOption) *MsgGrpc
NewMsgGrpc create new msg
func (*MsgGrpc) DoAndSubmit ¶
func (s *MsgGrpc) DoAndSubmit(queryPrepared string, busiCall func(bb *dtmcli.BranchBarrier) error, opts ...grpc.CallOption) error
DoAndSubmit one method for the entire prepare->busi->submit the error returned by busiCall will be returned if busiCall return ErrFailure, then abort is called directly if busiCall return not nil error other than ErrFailure, then DoAndSubmit will call queryPrepared to get the result
func (*MsgGrpc) DoAndSubmitDB ¶
func (s *MsgGrpc) DoAndSubmitDB(queryPrepared string, db *sql.DB, busiCall dtmcli.BarrierBusiFunc) error
DoAndSubmitDB short method for Do on db type. please see DoAndSubmit
type SagaGrpc ¶
SagaGrpc struct of saga
func NewSagaGrpc ¶
func NewSagaGrpc(server string, gid string, opts ...TransBaseOption) *SagaGrpc
NewSagaGrpc create a saga
func (*SagaGrpc) AddBranchOrder ¶
AddBranchOrder specify that branch should be after preBranches. branch should is larger than all the element in preBranches
func (*SagaGrpc) EnableConcurrent ¶
EnableConcurrent enable the concurrent exec of sub trans
type TccGlobalFunc ¶
TccGlobalFunc type of global tcc call
type TransBaseOption ¶ added in v1.16.4
TransBaseOption setup func for TransBase
func WithBranchHeaders ¶ added in v1.16.4
func WithBranchHeaders(headers map[string]string) TransBaseOption
WithBranchHeaders setup TransBase.BranchHeaders
type XaGrpc ¶
XaGrpc xa transaction
func XaGrpcFromRequest ¶
XaGrpcFromRequest construct xa info from request
func (*XaGrpc) CallBranch ¶
func (x *XaGrpc) CallBranch(msg proto.Message, url string, reply interface{}, opts ...grpc.CallOption) error
CallBranch call a xa branch
type XaGrpcGlobalFunc ¶
XaGrpcGlobalFunc type of xa global function