Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertBranchActionToGrpc(action Action) proto.Action
- func ConvertTranTypeToGrpc(tranType TranType) proto.TranType
- type Action
- type Branch
- func (branch *Branch) Convert() *proto.RegisterReq_Branch
- func (branch *Branch) SetData(data []byte) *Branch
- func (branch *Branch) SetHeader(header []byte) *Branch
- func (branch *Branch) SetLevel(level Level)
- func (branch *Branch) SetProtocol(protocol Protocol) *Branch
- func (branch *Branch) SetTimeout(timeout int64) *Branch
- type Client
- func (client *Client) AddGroup(skip bool, groups ...*Group) *Client
- func (client *Client) Begin(ctx context.Context) (gid string, err error)
- func (client *Client) Close(ctx context.Context) error
- func (client *Client) Register(ctx context.Context) error
- func (client *Client) SetGid(gid string) *Client
- func (client *Client) Start(ctx context.Context) (err error)
- type Group
- type Level
- type Option
- type Options
- type Protocol
- type TranType
Constants ¶
View Source
const ( TransactionUnknown TranType = "unknown" TCC TranType = "tcc" SAGA TranType = "saga" ActionUnknown = "unknown" Try Action = "try" Confirm Action = "confirm" Cancel Action = "cancel" // Normal and Compensation branch type for SAGA Normal Action = "normal" Compensation Action = "compensation" )
Variables ¶
View Source
var DefaultOptions = &Options{ connTimeout: 15 * time.Second, }
DefaultOptions default for a Client Options
View Source
var (
EmptyGroup = errors.New("The Group cannot be empty")
)
Functions ¶
func ConvertBranchActionToGrpc ¶
ConvertBranchActionToGrpc Convert action to pb.action
func ConvertTranTypeToGrpc ¶
ConvertTranTypeToGrpc Convert tranType to pb.TranType
Types ¶
type Action ¶
type Action consts.BranchAction
type Branch ¶
type Branch struct {
// contains filtered or unexported fields
}
func (*Branch) Convert ¶
func (branch *Branch) Convert() *proto.RegisterReq_Branch
Convert from client's Branch to pb.RegisterReq_Branch
func (*Branch) SetProtocol ¶
SetProtocol set branch network protocol
func (*Branch) SetTimeout ¶
SetTimeout set timeout for request branch
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client easycar client
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
func NewSagaGroup ¶
NewSagaGroup create a set of branches for Saga mode
func NewTccGroup ¶
NewTccGroup create a set of branches for TCC mode
func (*Group) GetTranType ¶
func (*Group) SetTimeout ¶
type Option ¶
type Option func(options *Options)
func WithConnTimeout ¶
func WithDiscovery ¶
func WithGrpcDailOpts ¶
func WithGrpcDailOpts(opts []grpc.DialOption) Option
func WithTactics ¶
func WithTactics(name balancer.TacticsName) Option
type TranType ¶
type TranType consts.TransactionType
Click to show internal directories.
Click to hide internal directories.