grpcpool

package
v0.0.0-...-d3b905b Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 19 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 DecodeGrpcErrorCode

func DecodeGrpcErrorCode(err error) (hasCode bool, code codes.Code)

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,
	opts ...Option,
) (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 Option

type Option func(o *Options)

func WithKeepaliveClientParams

func WithKeepaliveClientParams(keepalive keepalive.ClientParameters) Option

func WithOtelTracing

func WithOtelTracing(enabled bool) Option

func WithPingTestEveryNewConnection

func WithPingTestEveryNewConnection(pingFunc PingFunc) Option

func WithSnappyCompression

func WithSnappyCompression(enabled bool) Option

type Options

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

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