Documentation ¶
Index ¶
- type ChannelPool
- func (c *ChannelPool) ApplyLen() int
- func (c *ChannelPool) Close(conn IComputation) error
- func (c *ChannelPool) Get() (IComputation, error)
- func (c *ChannelPool) GetConns() chan *IdleConn
- func (c *ChannelPool) Len() int
- func (c *ChannelPool) Put(conn IComputation) error
- func (c *ChannelPool) Release() error
- type ComputationPool
- type IComputation
- type IdleConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelPool ¶
type ChannelPool struct {
// contains filtered or unexported fields
}
ChannelPool store connection information
func NewPool ¶
func NewPool(poolConfig *conf.PoolConfig, voiceFactory func() IComputation, logger logging.ILogger) (*ChannelPool, error)
NewPool new 1 pool
func (*ChannelPool) ApplyLen ¶
func (c *ChannelPool) ApplyLen() int
ApplyLen The number of connection that can be applied for.
func (*ChannelPool) Close ¶
func (c *ChannelPool) Close(conn IComputation) error
Close close single connection
func (*ChannelPool) Get ¶
func (c *ChannelPool) Get() (IComputation, error)
Get get a connection from pool
func (*ChannelPool) GetConns ¶
func (c *ChannelPool) GetConns() chan *IdleConn
GetConns get all connection
func (*ChannelPool) Len ¶
func (c *ChannelPool) Len() int
Len existing connections in the connection pool
func (*ChannelPool) Put ¶
func (c *ChannelPool) Put(conn IComputation) error
Put put the connection back into the pool
func (*ChannelPool) Release ¶
func (c *ChannelPool) Release() error
Release releasef all connection in ther connection pool
type ComputationPool ¶
type ComputationPool struct { ObjectPool *ChannelPool WorkerTask func(taskType, taskData string) (string, error) // contains filtered or unexported fields }
ComputationPool define computation pool
func InitComputationPool ¶
func InitComputationPool(poolConfig *conf.PoolConfig, computationFactory func() IComputation, initFunc func() error, logger logging.ILogger) (*ComputationPool, error)
InitComputationPool init computation pool
func (*ComputationPool) Process ¶
func (p *ComputationPool) Process(taskType, taskData string) (string, error)
Process -
func (*ComputationPool) Release ¶
func (p *ComputationPool) Release(computation IComputation) error
Release -
Click to show internal directories.
Click to hide internal directories.