pool

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrClosed is the error when the client pool is closed
	ErrClosed = errors.New("grpc pool: client pool is closed")
	// ErrTimeout is the error when the client pool timed out
	ErrTimeout = errors.New("grpc pool: client pool timed out")
	// ErrAlreadyClosed is the error when the client conn was already closed
	ErrAlreadyClosed = errors.New("grpc pool: the connection was already closed")
	// ErrFullPool is the error when the pool is already full
	ErrFullPool = errors.New("grpc pool: closing a ClientConn into a full pool")
)

Functions

This section is empty.

Types

type Conn

type Conn struct {
	*grpc.ClientConn
	// contains filtered or unexported fields
}

Conn is the wrapper for a grpc client conn.

func (*Conn) Close

func (c *Conn) Close() error

type Factory

type Factory func() (*grpc.ClientConn, error)

Factory is a function type creating a grpc client

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func New

func New(factory Factory, capacity int, timeout time.Duration) (*Pool, error)

func (*Pool) Capacity

func (p *Pool) Capacity() int

func (*Pool) Close

func (p *Pool) Close()

func (*Pool) Get

func (p *Pool) Get(ctx context.Context) (*Conn, error)

func (*Pool) IsClosed

func (p *Pool) IsClosed() bool

Jump to

Keyboard shortcuts

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