client

package
v16.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, rawAddress string, opts ...DialOption) (*grpc.ClientConn, error)

Dial dials a Gitaly node serving at the given address. Dial is used by the public 'client' package and the expected behavior is mostly documented there.

func FailOnNonTempDialError added in v16.4.0

func FailOnNonTempDialError() []grpc.DialOption

FailOnNonTempDialError helps to identify if remote listener is ready to accept new connections.

func StreamInterceptor

func StreamInterceptor() grpc.DialOption

StreamInterceptor returns the stream interceptors that should be configured for a client.

func UnaryInterceptor

func UnaryInterceptor() grpc.DialOption

UnaryInterceptor returns the unary interceptors that should be configured for a client.

Types

type DialOption

type DialOption func(*dialConfig)

DialOption is an option that can be passed to Dial.

func WithGrpcOptions

func WithGrpcOptions(opts []grpc.DialOption) DialOption

WithGrpcOptions will set up the given gRPC dial options so that they will be used when calling `grpc.DialContext()`.

func WithHandshaker

func WithHandshaker(handshaker Handshaker) DialOption

WithHandshaker sets up the given handshaker so that it's passed as the transport credentials which would be otherwise set. The transport credentials returned by handshaker are then set instead.

func WithTransportCredentials

func WithTransportCredentials(creds credentials.TransportCredentials) DialOption

WithTransportCredentials sets up the given credentials. By default, non-TLS connections will use insecure credentials whereas TLS connections will use the x509 system certificate pool. This option allows callers to override these defaults.

type Dialer added in v16.4.0

type Dialer func(ctx context.Context, address string, opts []grpc.DialOption) (*grpc.ClientConn, error)

Dialer is a dialer used to create new connections.

func HealthCheckDialer added in v16.4.0

func HealthCheckDialer(base Dialer) Dialer

HealthCheckDialer uses provided dialer as an actual dialer, but issues a health check request to the remote to verify the connection was set properly and could be used with no issues.

type Handshaker

type Handshaker interface {
	// ClientHandshake wraps the provided credentials and returns new credentials.
	ClientHandshake(credentials.TransportCredentials) credentials.TransportCredentials
}

Handshaker is an interface that allows for wrapping the transport credentials with a custom handshake.

type Pool added in v16.4.0

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

Pool is a pool of GRPC connections. Connections created by it are safe for concurrent use.

func NewPool added in v16.4.0

func NewPool(opts ...PoolOption) *Pool

NewPool creates a new connection pool that's ready for use.

func (*Pool) Close added in v16.4.0

func (p *Pool) Close() error

Close closes all connections tracked by the connection pool.

func (*Pool) Dial added in v16.4.0

func (p *Pool) Dial(ctx context.Context, address, token string) (*grpc.ClientConn, error)

Dial creates a new client connection in case no connection to the given address exists already or returns an already established connection. The returned address must not be `Close()`d.

type PoolOption added in v16.4.0

type PoolOption func(*poolConfig)

PoolOption is an option that can be passed to NewPool.

func WithDialOptions added in v16.4.0

func WithDialOptions(dialOptions ...grpc.DialOption) PoolOption

WithDialOptions sets gRPC options to use for the gRPC Dial call.

func WithDialer added in v16.4.0

func WithDialer(dialer Dialer) PoolOption

WithDialer sets the dialer that is called for each new gRPC connection the pool establishes.

Jump to

Keyboard shortcuts

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