connpool

package
v0.0.0-...-364fed7 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package connpool implements a gRPC connection pool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool implements a connection Pool to nodes in the cluster. All connections share the same set of DialOptions.

The Pool has a maximum number of connections, and the oldest unused connections will be closed and removed when opening a new one. Dead nodes will be automatically removed from the Pool.

func New

func New(maxConns int, opts ...grpc.DialOption) *Pool

New creates a new connection pool.

func (*Pool) Get

func (p *Pool) Get(addr string) (*grpc.ClientConn, error)

Get retrieves a cached addr or creates a new connection.

func (*Pool) Remove

func (p *Pool) Remove(addr string)

Remove deletes a conn from the pool.

Jump to

Keyboard shortcuts

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