package xdsdepmgr
import "google.golang.org/grpc/internal/xds/xdsdepmgr"
Package xdsdepmgr provides the implementation of the xDS dependency manager that manages all the xDS watches and resources as described in gRFC A74.
Index ¶
- func SetXDSClusterSubscriber(state resolver.State, subs ClusterSubscriber) resolver.State
- type ClusterSubscriber
- type ConfigWatcher
- type DependencyManager
- func New(listenerName, dataplaneAuthority string, xdsClient xdsclient.XDSClient, watcher ConfigWatcher) *DependencyManager
- func (m *DependencyManager) Close()
- func (m *DependencyManager) RequestDNSReresolution(opt resolver.ResolveNowOptions)
- func (m *DependencyManager) SubscribeToCluster(name string) func()
Functions ¶
func SetXDSClusterSubscriber ¶
func SetXDSClusterSubscriber(state resolver.State, subs ClusterSubscriber) resolver.State
SetXDSClusterSubscriber returns a copy of state in which the Attributes field is updated with the ClusterSubscriber interface.
Types ¶
type ClusterSubscriber ¶
type ClusterSubscriber interface {
// SubscribeToCluster creates a dynamic subscription for the named cluster.
//
// The returned cancel function must be called when the subscription is no
// longer needed. It is safe to call cancel multiple times.
SubscribeToCluster(clusterName string) (cancel func())
}
ClusterSubscriber allows dynamic subscription to clusters. This is useful for scenarios where the cluster name was not present in the RouteConfiguration, e.g. when the route uses a ClusterSpecifierPlugin.
The xDS resolver will pass this interface to the LB policies as an attribute in the resolver update.
func XDSClusterSubscriberFromResolverState ¶
func XDSClusterSubscriberFromResolverState(state resolver.State) ClusterSubscriber
XDSClusterSubscriberFromResolverState returns ClusterSubscriber interface stored as an attribute in the resolver state.
type ConfigWatcher ¶
type ConfigWatcher interface {
// Update is invoked when a new, validated xDS configuration is available.
//
// Implementations must treat the received config as read-only and should
// not modify it.
Update(*xdsresource.XDSConfig)
// Error is invoked when an error is received from the listener or route
// resource watcher. This includes cases where:
// - The listener or route resource watcher reports a resource error.
// - The received listener resource is a socket listener, not an API
// listener. TODO(i/8114): Implement this check.
// - The received route configuration does not contain a virtual host
// matching the channel's default authority.
Error(error)
}
ConfigWatcher is the interface for consumers of aggregated xDS configuration from the DependencyManager. The only consumer of this configuration is currently the xDS resolver.
type DependencyManager ¶
type DependencyManager struct {
// contains filtered or unexported fields
}
DependencyManager registers watches on the xDS client for all required xDS resources, resolves dependencies between them, and returns a complete configuration to the xDS resolver.
func New ¶
func New(listenerName, dataplaneAuthority string, xdsClient xdsclient.XDSClient, watcher ConfigWatcher) *DependencyManager
New creates a new DependencyManager.
- listenerName is the name of the Listener resource to request from the management server.
- dataplaneAuthority is used to select the best matching virtual host from the route configuration received from the management server.
- xdsClient is the xDS client to use to register resource watches.
- watcher is the ConfigWatcher interface that will receive the aggregated XDSConfig updates and errors.
func (*DependencyManager) Close ¶
func (m *DependencyManager) Close()
Close cancels all registered resource watches.
func (*DependencyManager) RequestDNSReresolution ¶
func (m *DependencyManager) RequestDNSReresolution(opt resolver.ResolveNowOptions)
RequestDNSReresolution calls all the DNS resolver's ResolveNow.
func (*DependencyManager) SubscribeToCluster ¶
func (m *DependencyManager) SubscribeToCluster(name string) func()
SubscribeToCluster increments the reference count for the cluster. If the cluster is not already being tracked, it is added to the clusterSubscriptions map. It returns a function to unsubscribe from the cluster i.e. decrease its refcount. This returned function is idempotent, meaning it can be called multiple times without any additional effect. Calling Subscribe in a blocking manner while handling an update will lead to a deadlock.
Source Files ¶
xds_dependency_manager.go
- Version
- v1.80.0 (latest)
- Published
- Apr 1, 2026
- Platform
- js/wasm
- Imports
- 12 packages
- Last checked
- 3 hours ago –
Tools for package owners.