pool

package
v2.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2017 License: MIT Imports: 10 Imported by: 0

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 KeepAliveDialer

func KeepAliveDialer(addr string, timeout time.Duration) (net.Conn, error)

KeepAliveDialer is a dialer that adds a 10 second TCP KeepAlive

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) 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