pool

package
v0.0.0-...-6a0c198 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: MIT Imports: 16 Imported by: 50

Documentation

Index

Constants

This section is empty.

Variables

DefaultDialOptions for connecting with servers

Global pool with connections

View Source
var RootCAs *x509.CertPool

RootCAs to use in API connections

Functions

func TLSConfig

func TLSConfig(serverName string) *tls.Config

TLSConfig that will be used when dialing securely without supplying TransportCredentials

Types

type Pool

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

Pool with connections

func NewPool

func NewPool(ctx context.Context, dialOptions ...grpc.DialOption) *Pool

NewPool returns a new connection pool that uses the given DialOptions

func (*Pool) AddDialOption

func (p *Pool) AddDialOption(opts ...grpc.DialOption)

AddDialOption adds DialOption for the pool. Only new connections will use these new DialOptions

func (*Pool) Close

func (p *Pool) Close(target ...string)

Close connections. If no target names supplied, just closes all.

func (*Pool) CloseConn

func (p *Pool) CloseConn(conn *grpc.ClientConn)

CloseConn closes a connection.

func (*Pool) DialInsecure

func (p *Pool) DialInsecure(target string) (*grpc.ClientConn, error)

DialInsecure gets a connection from the pool or creates a new one This function is blocking if grpc.WithBlock() is used

func (*Pool) DialSecure

func (p *Pool) DialSecure(target string, creds credentials.TransportCredentials) (*grpc.ClientConn, error)

DialSecure gets a connection from the pool or creates a new one This function is blocking if grpc.WithBlock() is used

func (*Pool) SetContext

func (p *Pool) SetContext(ctx context.Context)

SetContext sets a new background context for the pool. Only new connections will use this new context

Jump to

Keyboard shortcuts

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