Version: v0.0.0-...-7995a24 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2021 License: MIT Imports: 5 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Conn

type Conn struct {
	// contains filtered or unexported fields

conn is the wrapper for a net.Conn

func (*Conn) Get

func (conn *Conn) Get() net.Conn

get returns the real connection to use

func (*Conn) Recycle

func (conn *Conn) Recycle() error

recycle returns the connection to the pool if the unhealthy mark is set, close and it won't be put back to the pool

func (*Conn) Unhealthy

func (conn *Conn) Unhealthy()

unhealthy mark the connection as unhealthy when recycle called it will be closed and won't be put back to the pool

type ConnectionPool

type ConnectionPool struct {
	// contains filtered or unexported fields

connection pool

func GetConnectionPool

func GetConnectionPool() *ConnectionPool

get connection pool instance

func NewConnectionPool

func NewConnectionPool() *ConnectionPool

func (*ConnectionPool) GetConnection

func (connPool *ConnectionPool) GetConnection(ctx context.Context, addr string) (*Conn, error)

get connection from pool

func (*ConnectionPool) Init

func (connPool *ConnectionPool) Init(initConnections, maxConnections int, idleTimeout time.Duration) error

init connection pool

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL