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, func(), error)
- func NewWithBootstrapContentsForTesting(contents []byte) (XDSClient, func(), error)
- func NewWithConfig(config *bootstrap.Config) (XDSClient, func(), error)
- func NewWithConfigForTesting(config *bootstrap.Config, ...) (XDSClient, func(), 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 { // WatchResource uses xDS to discover the resource associated with the // provided resource name. The resource type implementation determines how // xDS requests are sent out and how responses are deserialized and // validated. Upon receipt of a response from the management server, an // appropriate callback on the watcher is invoked. // // Most callers will not have a need to use this API directly. They will // instead use a resource-type-specific wrapper API provided by the relevant // resource type implementation. // // // During a race (e.g. an xDS response is received while the user is calling // cancel()), there's a small window where the callback can be called after // the watcher is canceled. Callers need to handle this case. WatchResource(rType xdsresource.Type, resourceName string, watcher xdsresource.ResourceWatcher) (cancel func()) // DumpResources returns the status of the xDS resources. Returns a map of // resource type URLs to a map of resource names to resource state. DumpResources() map[string]map[string]xdsresource.UpdateWithMD ReportLoad(*bootstrap.ServerConfig) (*load.Store, func()) BootstrapConfig() *bootstrap.Config }
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.
The second return value represents a close function which releases the caller's reference on the returned client. The caller is expected to invoke it once they are done using the client. The underlying client will be closed only when all references are released, and it is safe for the caller to invoke this close function multiple times.
func NewWithBootstrapContentsForTesting ¶ added in v1.45.0
NewWithBootstrapContentsForTesting returns an xDS client for this config, separate from the global singleton.
The second return value represents a close function which the caller is expected to invoke once they are done using the client. It is safe for the caller to invoke this close function multiple times.
Testing Only ¶
This function should ONLY be used for testing purposes.
func NewWithConfig ¶
NewWithConfig returns a new xDS client configured by the given config.
The second return value represents a close function which releases the caller's reference on the returned client. The caller is expected to invoke it once they are done using the client. The underlying client will be closed only when all references are released, and it is safe for the caller to invoke this close function multiple times.
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, authorityIdleTimeout time.Duration) (XDSClient, func(), error)
NewWithConfigForTesting returns an xDS client for the specified bootstrap config, separate from the global singleton.
The second return value represents a close function which the caller is expected to invoke once they are done using the client. It is safe for the caller to invoke this close function multiple times.
Testing Only ¶
This function should ONLY be used for testing purposes. TODO(easwars): Document the new close func.
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 load provides functionality to record and maintain load data.
|
Package load provides functionality to record and maintain load data. |
Package tlscreds implements mTLS Credentials in xDS Bootstrap File.
|
Package tlscreds implements mTLS Credentials in xDS Bootstrap File. |
Package transport implements the xDS transport protocol functionality required by the xdsclient.
|
Package transport implements the xDS transport protocol functionality required by the xdsclient. |
Package xdslbregistry provides a registry of converters that convert proto from load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.
|
Package xdslbregistry provides a registry of converters that convert proto from load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration. |
converter
Package converter provides converters to convert proto load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration.
|
Package converter provides converters to convert proto load balancing configuration, defined by the xDS API spec, to JSON load balancing configuration. |
Package xdsresource implements the xDS data model layer.
|
Package xdsresource implements the xDS data model layer. |
version
Package version defines constants to distinguish between supported xDS API versions.
|
Package version defines constants to distinguish between supported xDS API versions. |