Documentation ¶
Index ¶
- Variables
- func BuildDirectTarget(uri string) string
- func BuildDiscoveryTarget(uri string) string
- func RegisterBalancerWithAlgorithm(name balancer.Algorithm)
- func RegisterBuilder(discovery registry.Discovery)
- 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 consts.Level) *Branch
- func (branch *Branch) SetProtocol(protocol Protocol) *Branch
- func (branch *Branch) SetTimeout(timeout int64) *Branch
- type Client
- func (client *Client) Begin(ctx context.Context) (gid string, err error)
- func (client *Client) Close(ctx context.Context) error
- func (client *Client) Commit(ctx context.Context, gid string) error
- func (client *Client) Register(ctx context.Context, gid string, groups []*Group) error
- func (client *Client) Rollback(ctx context.Context, gid string) error
- func (client *Client) Start(ctx context.Context, gid string) (err error)
- type Group
- type GroupOpt
- type HandlerFn
- type Manger
- type Option
- type Options
- type Protocol
Constants ¶
This section is empty.
Variables ¶
var DefaultOptions = &Options{ connTimeout: 15 * time.Second, dailOpts: []grpc.DialOption{ grpc.WithDefaultServiceConfig(`{"loadBalancingConfig": [{"easycarBalancer":{}}]}`), }, }
DefaultOptions default for a Client Options
var (
ErrEmpty = errors.New("The Group cannot be empty")
)
Functions ¶
func BuildDirectTarget ¶
BuildDirectTarget covert uri to direct target uri:127.0.0.1:8089,127.0.0.1:8085 => direct:///127.0.0.1:8089,127.0.0.1:8085
func BuildDiscoveryTarget ¶
BuildDiscoveryTarget covert uri to discovery target
func RegisterBalancerWithAlgorithm ¶
RegisterBalancerWithAlgorithm register grpc balancer with algorithm
func RegisterBuilder ¶
RegisterBuilder register Builder with discovery
Types ¶
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 client-go
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 (g *Group) GetTranType() consts.TransactionType
func (*Group) SetTimeout ¶
type Manger ¶
type Manger struct {
// contains filtered or unexported fields
}
func (*Manger) AddNextWaitGroups ¶
AddNextWaitGroups The group added this time will be executed after the completion of the call to the group added by the previous level call to AddNextWaitGroup example:m.AddGroups(group1,group2).AddNextWaitGroups(group3).AddGroups(group4),that means: first concurrent execution group1 and group2,then execution the group3,finally execution the group4
type Option ¶
type Option func(options *Options)
func WithAfterFunc ¶
func WithBeforeFunc ¶
func WithConnTimeout ¶
func WithDiscovery ¶
func WithDiscovery() Option
func WithGrpcDailOpts ¶
func WithGrpcDailOpts(opts []grpc.DialOption) Option