Documentation ¶
Overview ¶
Package xdsclient implements a full fledged gRPC client for the xDS API used by the xds resolver and balancer implementations.
Index ¶
- func ClearAllCountersForTesting()
- func ClearCounterForTesting(clusterName, edsServiceName string)
- func SetClient(state resolver.State, c XDSClient) resolver.State
- type ClusterRequestsCounter
- type XDSClient
- func FromResolverState(state resolver.State) XDSClient
- func New() (XDSClient, error)
- func NewWithBootstrapContentsForTesting(contents []byte) (XDSClient, error)
- func NewWithConfig(config *bootstrap.Config) (XDSClient, error)
- func NewWithConfigForTesting(config *bootstrap.Config, watchExpiryTimeout time.Duration) (XDSClient, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearAllCountersForTesting ¶ added in v1.40.0
func ClearAllCountersForTesting()
ClearAllCountersForTesting clears all the counters. Should be only used in tests.
func ClearCounterForTesting ¶
func ClearCounterForTesting(clusterName, edsServiceName string)
ClearCounterForTesting clears the counter for the service. Should be only used in tests.
Types ¶
type ClusterRequestsCounter ¶ added in v1.40.0
type ClusterRequestsCounter struct { ClusterName string EDSServiceName string // contains filtered or unexported fields }
ClusterRequestsCounter is used to track the total inflight requests for a service with the provided name.
func GetClusterRequestsCounter ¶ added in v1.40.0
func GetClusterRequestsCounter(clusterName, edsServiceName string) *ClusterRequestsCounter
GetClusterRequestsCounter returns the ClusterRequestsCounter with the provided serviceName. If one does not exist, it creates it.
func (*ClusterRequestsCounter) EndRequest ¶ added in v1.40.0
func (c *ClusterRequestsCounter) EndRequest()
EndRequest ends a request for a service, decrementing its number of requests by 1.
func (*ClusterRequestsCounter) StartRequest ¶ added in v1.40.0
func (c *ClusterRequestsCounter) StartRequest(max uint32) error
StartRequest starts a request for a cluster, incrementing its number of requests by 1. Returns an error if the max number of requests is exceeded.
type XDSClient ¶
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() }
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.
func FromResolverState ¶
FromResolverState returns the Client from state, or nil if not present.
func New ¶
New returns a new xDS client configured by the bootstrap file specified in env variable GRPC_XDS_BOOTSTRAP or GRPC_XDS_BOOTSTRAP_CONFIG.
The returned client is a reference counted singleton instance. This function creates a new client only when one doesn't already exist.
Note that the first invocation of New() or NewWithConfig() sets the client singleton. The following calls will return the singleton client without checking or using the config.
func NewWithBootstrapContentsForTesting ¶ added in v1.45.0
NewWithBootstrapContentsForTesting returns an xDS client for this config, separate from the global singleton.
Testing Only ¶
This function should ONLY be used for testing purposes.
func NewWithConfig ¶
NewWithConfig returns a new xDS client configured by the given config.
Internal/Testing Only
This function should ONLY be used for internal (c2p resolver) and/or testing purposese. DO NOT use this elsewhere. Use New() instead.
func NewWithConfigForTesting ¶
func NewWithConfigForTesting(config *bootstrap.Config, watchExpiryTimeout time.Duration) (XDSClient, error)
NewWithConfigForTesting returns an xDS client for the specified bootstrap config, separate from the global singleton.
Testing Only ¶
This function should ONLY be used for testing purposes.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bootstrap provides the functionality to initialize certain aspects of an xDS client by reading a bootstrap file.
|
Package bootstrap provides the functionality to initialize certain aspects of an xDS client by reading a bootstrap file. |
Package controller contains implementation to connect to the control plane.
|
Package controller contains implementation to connect to the control plane. |
version
Package version defines APIs to deal with different versions of xDS.
|
Package version defines APIs to deal with different versions of xDS. |
version/v2
Package v2 provides xDS v2 transport protocol specific functionality.
|
Package v2 provides xDS v2 transport protocol specific functionality. |
version/v3
Package v3 provides xDS v3 transport protocol specific functionality.
|
Package v3 provides xDS v3 transport protocol specific functionality. |
Package load provides functionality to record and maintain load data.
|
Package load provides functionality to record and maintain load data. |
Package pubsub implements a utility type to maintain resource watchers and the updates.
|
Package pubsub implements a utility type to maintain resource watchers and the updates. |
Package xdsresource contains functions to proto xds updates (unmarshal from proto), and types for the resource updates.
|
Package xdsresource contains functions to proto xds updates (unmarshal from proto), and types for the resource updates. |
version
Package version defines constants to distinguish between supported xDS API versions.
|
Package version defines constants to distinguish between supported xDS API versions. |