Documentation ¶
Index ¶
- type Option
- func WithConnTimeout(connTimeout time.Duration) Option
- func WithIdleConnTimeout(idleConnTimeout time.Duration) Option
- func WithMaxOpenConns(maxOpenConns int32) Option
- func WithMaxRetry(maxRetry int32) Option
- func WithPoolSize(poolSize int32) Option
- func WithReadTimeout(readTimeout time.Duration) Option
- func WithWriteTimeout(writeTimeout time.Duration) Option
- type Pool
- type PoolStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options)
Option is the type for the functional options for the pool
func WithConnTimeout ¶
WithConnTimeout sets the connTimeout option
func WithIdleConnTimeout ¶
WithIdleConnTimeout sets the idleConnTimeout option
func WithMaxOpenConns ¶
WithMaxOpenConns sets the maxOpenConns option
func WithReadTimeout ¶
WithReadTimeout sets the readTimeout option
func WithWriteTimeout ¶
WithWriteTimeout sets the writeTimeout option
type Pool ¶
type Pool interface { // Get returns a connection from the pool, the number of retries and a boolean indicating if the connection is new // It takes a context to control the deadline and timeout // It also takes an address to specify which host to connect Get(ctx context.Context, address string) (net.Conn, int32, bool, error) // Put returns a connection to the pool Put(net.Conn) error // Status returns a map of addresses and their connection status Status() map[string]*PoolStatus }
Pool is the interface for a tcp connection pool
type PoolStatus ¶
type PoolStatus struct { // PooledConns is the current number of connections in the pool PooledConns int32 // OpenConns is the total number of connections for the address OpenConns int32 // FreeCons is the total number of conntions that left could be opened. FreeConns int32 // contains filtered or unexported fields }
PoolStatus is a struct that contains the current pool size and total connection number for an address
Click to show internal directories.
Click to hide internal directories.