diff --git a/xds/internal/xdsclient/attributes.go b/xds/internal/xdsclient/attributes.go index 51418162..9076a76f 100644 --- a/xds/internal/xdsclient/attributes.go +++ b/xds/internal/xdsclient/attributes.go @@ -17,36 +17,12 @@ package xdsclient -import ( - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/xds/internal/xdsclient/bootstrap" - "google.golang.org/grpc/xds/internal/xdsclient/load" - "google.golang.org/grpc/xds/internal/xdsclient/xdsresource" -) +import "google.golang.org/grpc/resolver" type clientKeyType string const clientKey = clientKeyType("grpc.xds.internal.client.Client") -// XDSClient is a full fledged gRPC client which queries a set of discovery APIs -// (collectively termed as xDS) on a remote management server, to discover -// various dynamic resources. -type XDSClient interface { - WatchListener(string, func(xdsresource.ListenerUpdate, error)) func() - WatchRouteConfig(string, func(xdsresource.RouteConfigUpdate, error)) func() - WatchCluster(string, func(xdsresource.ClusterUpdate, error)) func() - WatchEndpoints(clusterName string, edsCb func(xdsresource.EndpointsUpdate, error)) (cancel func()) - ReportLoad(server *bootstrap.ServerConfig) (*load.Store, func()) - - DumpLDS() map[string]xdsresource.UpdateWithMD - DumpRDS() map[string]xdsresource.UpdateWithMD - DumpCDS() map[string]xdsresource.UpdateWithMD - DumpEDS() map[string]xdsresource.UpdateWithMD - - BootstrapConfig() *bootstrap.Config - Close() -} - // FromResolverState returns the Client from state, or nil if not present. func FromResolverState(state resolver.State) XDSClient { cs, _ := state.Attributes.Value(clientKey).(XDSClient) diff --git a/xds/internal/xdsclient/client.go b/xds/internal/xdsclient/client.go index 817a4507..90551986 100644 --- a/xds/internal/xdsclient/client.go +++ b/xds/internal/xdsclient/client.go @@ -29,9 +29,29 @@ import ( "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/grpcsync" "google.golang.org/grpc/xds/internal/xdsclient/bootstrap" + "google.golang.org/grpc/xds/internal/xdsclient/load" "google.golang.org/grpc/xds/internal/xdsclient/xdsresource" ) +// XDSClient is a full fledged gRPC client which queries a set of discovery APIs +// (collectively termed as xDS) on a remote management server, to discover +// various dynamic resources. +type XDSClient interface { + WatchListener(string, func(xdsresource.ListenerUpdate, error)) func() + WatchRouteConfig(string, func(xdsresource.RouteConfigUpdate, error)) func() + WatchCluster(string, func(xdsresource.ClusterUpdate, error)) func() + WatchEndpoints(string, func(xdsresource.EndpointsUpdate, error)) func() + ReportLoad(*bootstrap.ServerConfig) (*load.Store, func()) + + DumpLDS() map[string]xdsresource.UpdateWithMD + DumpRDS() map[string]xdsresource.UpdateWithMD + DumpCDS() map[string]xdsresource.UpdateWithMD + DumpEDS() map[string]xdsresource.UpdateWithMD + + BootstrapConfig() *bootstrap.Config + Close() +} + // clientImpl is the real implementation of the xds client. The exported Client // is a wrapper of this struct with a ref count. //