Documentation
¶
Index ¶
- Constants
- func SetupLogger(flogger *flogging.FabricLogger)
- func WithBalanceDuration(duration time.Duration) func(*algorithmGrpcClientPool)
- func WithConnectionFunc(connFuc func(ctx context.Context, target string) (*grpc.ClientConn, error)) func(*algorithmGrpcClientPool)
- func WithConnectionTime(duration time.Duration) func(*algorithmGrpcClientPool)
- func WithPoolMaxFreeSize(maxFreeSize uint32) func(*algorithmGrpcClientPool)
- func WithPoolMaxSize(maxSize uint32) func(*algorithmGrpcClientPool)
- func WithUsingLimit(usingLimit uint32) func(*algorithmGrpcClientPool)
- type AlgorithmGrpcClientPool
Constants ¶
View Source
const ( // 一条链接同时最多允许1000个请求同时占用 MaxUsingLimit = 1000 ConnTimeOut = 10 * time.Second MaxFreeConn = 10 MaxConn = 256 Balance = 10 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func SetupLogger ¶
func SetupLogger(flogger *flogging.FabricLogger)
func WithBalanceDuration ¶
执行balance的时间间隔
func WithConnectionFunc ¶
func WithConnectionFunc(connFuc func(ctx context.Context, target string) (*grpc.ClientConn, error)) func(*algorithmGrpcClientPool)
替换默认的连接函数
func WithConnectionTime ¶
在使用默认连接函数时,连接超时时间
func WithPoolMaxFreeSize ¶
func WithPoolMaxFreeSize(maxFreeSize uint32) func(*algorithmGrpcClientPool)
连接池空闲时保留的最大连接数
func WithPoolMaxSize ¶
func WithPoolMaxSize(maxSize uint32) func(*algorithmGrpcClientPool)
连接池最大的连接数
func WithUsingLimit ¶
func WithUsingLimit(usingLimit uint32) func(*algorithmGrpcClientPool)
同一条连接的最大占用数量
Types ¶
type AlgorithmGrpcClientPool ¶
type AlgorithmGrpcClientPool interface { PickClient() (*grpc.ClientConn, error) BackClient(conn *grpc.ClientConn) Release() }
func NewConnectionsPool ¶
func NewConnectionsPool(ctx context.Context, target string, ops ...func(*algorithmGrpcClientPool)) AlgorithmGrpcClientPool
Click to show internal directories.
Click to hide internal directories.