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 // 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(ctx context.Context, cfg *Config) (*ClientProxy, error)
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) Debug ¶ added in v0.12.0
func (vtctld *ClientProxy) Debug() map[string]any
Debug implements debug.Debuggable for ClientProxy.
type Config ¶
type Config struct { Credentials *grpcclient.StaticAuthClientCreds CredentialsPath string Cluster *vtadminpb.Cluster ResolverOptions *resolver.Options // contains filtered or unexported fields }
Config represents the options that modify the behavior of a Proxy.
type ConfigOption ¶ added in v0.14.0
ConfigOption is a function that mutates a Config. It should return the same Config structure, in a builder-pattern style.
func WithDialFunc ¶ added in v0.14.0
func WithDialFunc(f func(addr string, ff grpcclient.FailFast, opts ...grpc.DialOption) (vtctldclient.VtctldClient, error)) ConfigOption
WithDialFunc returns a ConfigOption that applies the given dial function to a Config.
It is used to support dependency injection in tests, and needs to be exported for higher-level tests (via vtadmin/testutil).
type Proxy ¶
type Proxy interface { // 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. // // Once closed, a proxy is not safe for reuse. Close() error vtctlservicepb.VtctldClient }
Proxy defines the connection interface of a proxied vtctldclient used by VTAdmin clusters.