Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrPoolFull 池满 ErrPoolFull = errors.New("grpc pool closing a ClientConn into a full pool") // ErrPoolTimeout 超时 ErrPoolTimeout = errors.New("grpc pool get client timeout") // ErrPoolClosed 已关闭 ErrPoolClosed = errors.New("grpc pool is closed") // ErrPoolCapacity 错误的容量设置 ErrPoolCapacity = errors.New("grpc pool wrong capacity") )
Functions ¶
This section is empty.
Types ¶
type ClientConn ¶
type ClientConn struct { *grpc.ClientConn // contains filtered or unexported fields }
ClientConn grpc.ClientConn 的包装
type GRPCConnFactory ¶
type GRPCConnFactory func() (*grpc.ClientConn, error)
GRPCConnFactory 用于提供创建grpc.ClientConn
type GRPCPool ¶
type GRPCPool struct {
// contains filtered or unexported fields
}
GRPCPool grpc client pool
func NewGRPCPool ¶
func NewGRPCPool(factory GRPCConnFactory, initNum, capacity int, idleTimeout time.Duration) (*GRPCPool, error)
NewGRPCPool 新建 grpc 连接池
Click to show internal directories.
Click to hide internal directories.