Documentation ¶
Overview ¶
Package pool available index queue
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connectors ¶
type Connectors struct { //This function is called when automatic serialization is performed, and it can be modified to use a custom serialization method //进行自动序列化时将调用这个函数,修改它可以使用自定义的序列化方式 EncodingFunc func(v interface{}) []byte // contains filtered or unexported fields }
Connectors connection pool
连接池
func NewConnectors ¶
func NewConnectors(cfg *conf.Config) *Connectors
NewConnectors initialize the connection pool using the configuration
@param cfg config
使用配置初始化连接池
func (*Connectors) GetClient ¶
func (c *Connectors) GetClient() *Client
GetClient gets an error-free connection and, if there is an error, returns when the connected function is called
@return *Client
获取一个无错误的连接,如果有错误,将在调用连接的函数时返回
func (*Connectors) Info ¶
func (c *Connectors) Info() string
Info returns connection pool status information
@return string
返回连接池状态信息
func (*Connectors) NewClient ¶
func (c *Connectors) NewClient() (cli *Client, err error)
NewClient take a new connection in the connection pool and return an error if there is an error
@return client new client @return error possible error, operation successfully returned nil
在连接池取一个新连接,如果出错将返回一个错误
func (*Connectors) SetNewClientRetryCount ¶
func (c *Connectors) SetNewClientRetryCount(count byte)
SetNewClientRetryCount The number of times a connection is fetched from the fast connection pool, more than the retry number will enter the slow connection pool
@param count retry number
设置重试次数,大于这个次数就进入慢速池
func (*Connectors) Start ¶
func (c *Connectors) Start() (err error)
Start start connectors
@return error,possible error, operation successfully returned nil
启动连接池
type Pool ¶
type Pool struct { //new client New func() (*Client, error) // contains filtered or unexported fields }
Pool pool block 连接池结构
func (*Pool) Get ¶
Get get a pooled connection
@return *Client,client @return error possible error, operation successfully returned nil
获取一个缓存的连接
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue queue for available index 可用连接的队列