Documentation ¶
Overview ¶
Package dialer provides a caching gRPC dialer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextResolver ¶
ContextResolver returns a Resolver. It may be nil if the value was never set.
func ContextWithDialer ¶
ContextWithDialer attaches a Dialer to the given context.
Types ¶
type ClientConn ¶
type ClientConn interface { grpc.ClientConnInterface Close() error }
A ClientConn is a wrapper around the gRPC client connection interface but ensures there is a way to close the connection.
func DialDirectGRPC ¶
DialDirectGRPC dials a gRPC server directly.
type Dialer ¶
type Dialer interface { // Dial makes a connection to the given target with the supplied options. Dial(ctx context.Context, target string, opts ...grpc.DialOption) (ClientConn, error) // Close ensures all connections made are cleanly closed. Close() error }
A Dialer is responsible for making connections to gRPC endpoints.
func ContextDialer ¶
ContextDialer returns a Dialer. It may be nil if the value was never set.
func NewCachedDialer ¶
func NewCachedDialer() Dialer
NewCachedDialer returns a Dialer that returns the same connection if it already has been established at a particular target (regardless of the options used).
type RefCountedConnWrapper ¶
type RefCountedConnWrapper struct {
// contains filtered or unexported fields
}
RefCountedConnWrapper wraps a ClientConn to be reference counted.
func NewRefCountedConnWrapper ¶
func NewRefCountedConnWrapper(conn ClientConn, onUnref func()) *RefCountedConnWrapper
NewRefCountedConnWrapper wraps the given connection to be able to be reference counted.
func (*RefCountedConnWrapper) Ref ¶
func (w *RefCountedConnWrapper) Ref() ClientConn
Ref returns a new reference to the underlying ClientConn.
type ReffedConn ¶
type ReffedConn struct { ClientConn // contains filtered or unexported fields }
A ReffedConn reference counts a ClieentConn and closes it on the last dereference.
func (*ReffedConn) Close ¶
func (rc *ReffedConn) Close() error
Close will deref the reference and if it is the last to do so, will close the underlying connection.