Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrOptionMinOrMax = errors.New("invalid MinConn or MaxConn") ErrConnection = errors.New("connection error") ErrInitFailed = errors.New("failed to initialize connection") ErrClosed = errors.New("client pool is closed") ErrNoAvailableConn = errors.New("no available connections") ErrTimeout = errors.New("client pool timeout exceeded") ErrAlreadyClosed = errors.New("connection was already closed") ErrFullPool = errors.New("attempt to destroy ClientConn in a full pool") )
Error variables for common error scenarios
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a single gRPC connection in the pool
func (*Connection) Free ¶
func (c *Connection) Free()
Free marks the connection as not in use and updates the last used timestamp
func (*Connection) GetConn ¶
func (c *Connection) GetConn() *grpc.ClientConn
GetConn returns the underlying gRPC client connection
func (*Connection) IsReady ¶
func (c *Connection) IsReady() bool
IsReady checks if the connection is ready for use
type Logger ¶
type Logger interface { Debug(msg ...interface{}) Error(msg ...interface{}) }
Logger - interface for logger
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool represents a pool of gRPC client connections
func NewPool ¶
func NewPool(factory connectionFactory, options PoolOptions) (*Pool, error)
NewPool creates a new connection pool with the given factory and options
func (*Pool) Get ¶
func (p *Pool) Get() (*Connection, error)
Get retrieves an available connection from the pool or creates a new one if possible
Click to show internal directories.
Click to hide internal directories.