connPool

package
v0.0.0-...-02c04b0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 一条链接同时最多允许1000个请求同时占用
	MaxUsingLimit = 1000
	ConnTimeOut   = 10 * time.Second
	MaxFreeConn   = 10
	MaxConn       = 256
	Balance       = 10 * time.Second
	Unavailable   = uint32(1<<32 - 1)
)

Variables

This section is empty.

Functions

func SetupLogger

func SetupLogger(flogger *flogging.FabricLogger)

func WithBalanceDuration

func WithBalanceDuration(duration time.Duration) func(*algorithmGrpcClientPool)

执行balance的时间间隔

func WithConnectionFunc

func WithConnectionFunc(connFuc func(ctx context.Context, target string) (*grpc.ClientConn, error)) func(*algorithmGrpcClientPool)

替换默认的连接函数

func WithConnectionTime

func WithConnectionTime(duration time.Duration) func(*algorithmGrpcClientPool)

在使用默认连接函数时,连接超时时间

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

Jump to

Keyboard shortcuts

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