Documentation ¶
Index ¶
Constants ¶
View Source
const ( // PoolModeStrict 在实际创建连接数达上限后,池子中没有连接时不会新建连接 PoolModeStrict = iota // PoolModeLoose 在实际创建连接数达上限后,池子中没有连接时会新建连接 PoolModeLoose )
Variables ¶
View Source
var ( // ErrorOption ErrorOption = "option error" // ErrorPoolInit 连接p池初始化出错 ErrorPoolInit = "pool init error" //ErrorGetTimeout 获取连接超时 ErrorGetTimeout = "getting connection client timeout from pool" //ErrorDialConn 创建连接时发生错误 ErrorDialConn = "dialing connection error" // ErrorPoolIsClosed 连接池已关闭 ErrorPoolIsClosed = "pool is closed" )
Functions ¶
Types ¶
type Client ¶ added in v0.4.3
type Client struct { *grpc.ClientConn // contains filtered or unexported fields }
Client grpc client
type Option ¶ added in v0.4.3
type Option struct { // func() (*grpc.ClientConn, error) Factor Factor //Init init 连接数 Init int32 //Cap 连接上限 Cap int32 //IdleDur IdleDur time.Duration // MaxLifeDur MaxLifeDur time.Duration // Timeout pool关闭时 Timeout time.Duration // 模式 Mode int }
Option pool param option
Click to show internal directories.
Click to hide internal directories.