Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientProxy ¶
type ClientProxy struct { vtctldclient.VtctldClient // embedded to provide easy implementation of the vtctlservicepb.VtctldClient interface // DialFunc is called to open a new vtctdclient connection. In production, // this should always be grpcvtctldclient.NewWithDialOpts, but it is // exported for testing purposes. DialFunc func(addr string, ff grpcclient.FailFast, opts ...grpc.DialOption) (vtctldclient.VtctldClient, error) // contains filtered or unexported fields }
ClientProxy implements the Proxy interface relying on a discovery.Discovery implementation to handle vtctld discovery and connection management.
func New ¶
func New(cfg *Config) *ClientProxy
New returns a ClientProxy to the given cluster. When Dial-ing, it will use the given discovery implementation to find a vtctld to connect to, and the given creds to dial the underlying gRPC connection, both of which are provided by the Config.
It does not open a connection to a vtctld; users must call Dial before first use.
func (*ClientProxy) Close ¶
func (vtctld *ClientProxy) Close() error
Close is part of the Proxy interface.
func (*ClientProxy) Dial ¶
func (vtctld *ClientProxy) Dial(ctx context.Context) error
Dial is part of the Proxy interface.
func (*ClientProxy) Hostname ¶
func (vtctld *ClientProxy) Hostname() string
Hostname is part of the Proxy interface.
type Config ¶
type Config struct { Discovery discovery.Discovery Credentials *grpcclient.StaticAuthClientCreds CredentialsPath string Cluster *vtadminpb.Cluster }
Config represents the options that modify the behavior of a Proxy.
type Proxy ¶
type Proxy interface { // Dial opens a gRPC connection to a vtctld in the cluster. If the Proxy // already has a valid connection, this is a no-op. Dial(ctx context.Context) error // Hostname returns the hostname the Proxy is currently connected to. Hostname() string // Close closes the underlying vtctldclient connection. This is a no-op if // the Proxy has no current, valid connection. It is safe to call repeatedly. // Users may call Dial on a previously-closed Proxy to create a new // connection, but that connection may not be to the same particular vtctld. Close() error vtctlservicepb.VtctldClient }
Proxy defines the connection interface of a proxied vtctldclient used by VTAdmin clusters.