grpcpool

package
v0.0.0-...-137c36e Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeGrpcError

func DecodeGrpcError(err error) (connectionFailure bool, returnErr error)

func GrpcErrIsConnFail

func GrpcErrIsConnFail(err error) (connectionFailure bool)

func LoadTLSCredentials

func LoadTLSCredentials(caCertPEM []byte, clientCertPEM []byte, clientKeyPEM []byte) (credentials.TransportCredentials, error)

func RegisterSnappyCompressor

func RegisterSnappyCompressor()

func SnappyCompressor

func SnappyCompressor() string

Types

type ConnectionFactory

type ConnectionFactory interface {
	NewConnection(ctx context.Context) (*grpc.ClientConn, error)
	ConnectionOk(ctx context.Context, conn *grpc.ClientConn) error
}

type MutualTLSFactory

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

func NewMutualTLSFactory

func NewMutualTLSFactory(
	caCertPEM []byte,
	clientCertPEM []byte,
	clientKeyPEM []byte,
	serverAddress string,
	keepAliveTime time.Duration,
	keepAliveTimeout time.Duration,
	pingFunc PingFunc,
	useSnappyCompression bool,
) (MutualTLSFactory, error)

func (MutualTLSFactory) ConnectionOk

func (f MutualTLSFactory) ConnectionOk(ctx context.Context, conn *grpc.ClientConn) error

func (MutualTLSFactory) NewConnection

func (f MutualTLSFactory) NewConnection(ctx context.Context) (*grpc.ClientConn, error)

func (MutualTLSFactory) NewConnectionWithDialOpts

func (f MutualTLSFactory) NewConnectionWithDialOpts(ctx context.Context, opts ...grpc.DialOption) (*grpc.ClientConn, error)

type PingFunc

type PingFunc func(ctx context.Context, conn *grpc.ClientConn) (time.Duration, error)

PingFunc should send a GRPC ping/pong to the other side of conn. Returns err or latency.

type Pool

type Pool interface {
	Get(context.Context) (PoolClientConn, error)
}

type PoolClientConn

type PoolClientConn interface {
	Return()
	Connection() *grpc.ClientConn
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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