Documentation ¶
Index ¶
- Constants
- Variables
- func Call(meta *registry.Metadata, fn func(conn grpc.ClientConnInterface) error) error
- func Init(ctx context.Context, opt *Options, connSetting ...registry.GrpcMeta)
- func NodeDial(ctx context.Context, scheme, serviceName string, opts *Options) (*grpc.ClientConn, error)
- type Builder
- type ClientConn
- type Conn
- type Option
- type Options
- type Pool
Constants ¶
View Source
const ( // KeepAliveTime 在此时间后客户端没看到任何活动,将ping服务器 KeepAliveTime = time.Duration(10) * time.Second // KeepAliveTimeout 客户端在ping以后等待的时间 KeepAliveTimeout = time.Duration(3) * time.Second DefaultMaxIdle = 1 DefaultMaxActive = 64 DefaultMaxStreamsPerConn = 1000 DefaultMaxConnIdleSecond = time.Minute DefaultMaxWaitConnTime = 20 * time.Millisecond )
Variables ¶
View Source
var (
ClosedErr = errors.New("grpc pool has closed")
)
View Source
var ErrorKeyNotExist = errors.New("key not exist")
Functions ¶
Types ¶
type Builder ¶
type Builder func() (*grpc.ClientConn, error)
type ClientConn ¶
type ClientConn interface { grpc.ClientConnInterface // contains filtered or unexported methods }
type Conn ¶
type Conn interface { Value() ClientConn Close() // contains filtered or unexported methods }
type Option ¶
type Option func(*Options)
Option optional configs
func WithConnIdleSeconds ¶
func WithDialOptions ¶
func WithDialOptions(opts ...grpc.DialOption) Option
func WithMaxActive ¶
func WithMaxIdle ¶
func WithWaitConn ¶
Click to show internal directories.
Click to hide internal directories.