Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- func (c *Config) DailTimeout() time.Duration
- func (c *Config) GetDailStringByIndex(index int) string
- func (c *Config) IsTls() bool
- func (c *Config) MaxIdle() int
- func (c *Config) MaxLifetime() time.Duration
- func (c *Config) MaxRecvMsgSize() int
- func (c *Config) MaxSendMsgSize() int
- func (c *Config) MaxStreamLifetime() time.Duration
- func (c *Config) Namespace() string
- func (c *Config) NodeIPs() []string
- func (c *Config) SetDailTimeout(dailTimeout time.Duration)
- func (c *Config) SetMaxIdle(maxIdle int)
- func (c *Config) SetMaxLifetime(maxLifetime time.Duration)
- func (c *Config) SetMaxRecvMsgSize(maxRecvMsgSize int)
- func (c *Config) SetMaxSendMsgSize(maxSendMsgSize int)
- func (c *Config) SetTargets(targets []string)
- func (c *Config) Targets() []string
- func (c *Config) TlsDomain() string
- func (c *Config) TlscaPath() string
- func (c *Config) Viper() *viper.Viper
- type GrpcStream
- type IdleStream
- type StreamPool
Constants ¶
View Source
const ( MaxPoolCapacityNumber = 10 MinPoolCapacityNumber = 0 MaxStreamNumber = 10 MinStreamNumber = 0 )
Variables ¶
View Source
var ( //ErrClosed 连接池已经关闭Error ErrClosed = errors.New("pool is closed") // RejectForNil 拒绝操作 RejectForNil = errors.New("connection is nil. rejecting") // ErrPoolFull 连接池已满 ErrPoolFull = errors.New("pool is full, can not put") // ErrPoolEmpty 连接池已空 ErrPoolEmpty = errors.New("pool is empty, can not get") // ErrTargets 错误的端口号 ErrTargets = errors.New("dail target is not exist") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func NewConfigWithPath ¶
func (*Config) DailTimeout ¶
func (*Config) GetDailStringByIndex ¶
func (*Config) MaxLifetime ¶
func (*Config) MaxRecvMsgSize ¶
func (*Config) MaxSendMsgSize ¶
func (*Config) MaxStreamLifetime ¶
func (*Config) SetDailTimeout ¶
func (*Config) SetMaxIdle ¶
func (*Config) SetMaxLifetime ¶
func (*Config) SetMaxRecvMsgSize ¶
func (*Config) SetMaxSendMsgSize ¶
func (*Config) SetTargets ¶
type GrpcStream ¶
type IdleStream ¶
type IdleStream struct {
// contains filtered or unexported fields
}
func (*IdleStream) Close ¶
func (c *IdleStream) Close() error
func (*IdleStream) GetStream ¶
func (id *IdleStream) GetStream() GrpcStream
func (*IdleStream) ResetTime ¶
func (id *IdleStream) ResetTime()
type StreamPool ¶
type StreamPool struct {
// contains filtered or unexported fields
}
func NewStreamWithContext ¶
func NewStreamWithContext(aliveTime time.Duration, num int, factory func(ctx context.Context) (GrpcStream, error)) (*StreamPool, error)
func (*StreamPool) Capacity ¶
func (s *StreamPool) Capacity() int32
func (*StreamPool) Close ¶
func (s *StreamPool) Close() error
func (*StreamPool) Get ¶
func (s *StreamPool) Get() (*IdleStream, error)
func (*StreamPool) Put ¶
func (s *StreamPool) Put(stream *IdleStream) error
Click to show internal directories.
Click to hide internal directories.