pool

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPoolClosed = errors.New("pool is closed")

Functions

This section is empty.

Types

type CallOption

type CallOption func(*callOptions)

func WithNoRetry

func WithNoRetry() CallOption

func WithRetryResolver

func WithRetryResolver(f RetryResolver) CallOption

type CallerFunc

type CallerFunc func(ctx context.Context, conn *grpc.ClientConn) error

type Factory

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

Factory is a function type creating a grpc client.

type GRPCPool

type GRPCPool interface {
	Close()
	Call(ctx context.Context, timeout time.Duration, caller CallerFunc, opts ...CallOption) error
}

func New

func New(ctx context.Context, factory Factory, capacity int, idleTimeout, maxLifeDuration time.Duration) GRPCPool

func NewSingleConnPool

func NewSingleConnPool(_ context.Context, factory Factory) (GRPCPool, error)

type Pool

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

Pool is the grpc client pool.

func (*Pool) Call

func (p *Pool) Call(ctx context.Context, timeout time.Duration, caller CallerFunc, opts ...CallOption) error

func (*Pool) Close

func (p *Pool) Close()

func (*Pool) IsClosed

func (p *Pool) IsClosed() bool

IsClosed returns true if the client pool is closed.

type RetryResolver

type RetryResolver func(reqErr error) (isRetrievable bool)

type SingleConnectionPool

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

func (*SingleConnectionPool) Call

func (p *SingleConnectionPool) Call(ctx context.Context, timeout time.Duration, caller CallerFunc, opts ...CallOption) error

func (*SingleConnectionPool) Close

func (p *SingleConnectionPool) Close()

Jump to

Keyboard shortcuts

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