Class XdsClientImpl
java.lang.Object
io.grpc.xds.client.XdsClient
io.grpc.xds.client.XdsClientImpl
- All Implemented Interfaces:
XdsClient.ResourceStore
XdsClient implementation.
-
Nested Class Summary
Nested classes/interfaces inherited from class XdsClient
XdsClient.ResourceMetadata, XdsClient.ResourceStore, XdsClient.ResourceUpdate, XdsClient.ResourceWatcher<T> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionXdsClientImpl(XdsTransportFactory xdsTransportFactory, Bootstrapper.BootstrapInfo bootstrapInfo, ScheduledExecutorService timeService, io.grpc.internal.BackoffPolicy.Provider backoffPolicyProvider, com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier, io.grpc.internal.TimeProvider timeProvider, MessagePrettyPrinter messagePrinter, Object securityConfig) -
Method Summary
Modifier and TypeMethodDescriptionaddClusterDropStats(Bootstrapper.ServerInfo serverInfo, String clusterName, String edsServiceName) Adds drop stats for the specified cluster with edsServiceName by using the returned object to record dropped requests.addClusterLocalityStats(Bootstrapper.ServerInfo serverInfo, String clusterName, String edsServiceName, Locality locality) Adds load stats for the specified locality (in the specified cluster with edsServiceName) by using the returned object to record RPCs.<T extends XdsClient.ResourceUpdate>
voidcancelXdsResourceWatch(XdsResourceType<T> type, String resourceName, XdsClient.ResourceWatcher<T> watcher) Unregisters the given resource watcher.Returns the config used to bootstrap this XdsClientBootstrapper.BootstrapInfo.io.grpc.xds.client.ControlPlaneClientgetOrCreateControlPlaneClient(Bootstrapper.ServerInfo serverInfo) Returns the implementation specific security configuration used in this XdsClient.Returns a map of control plane server info objects to the LoadReportClients that are responsible for sending load reports to the control plane servers.getSubscribedResources(Bootstrapper.ServerInfo serverInfo, XdsResourceType<? extends XdsClient.ResourceUpdate> type) Returns the collection of resources currently subscribing to ornullif not subscribing to any resources for the given type.com.google.common.util.concurrent.ListenableFuture<Map<XdsResourceType<?>, Map<String, XdsClient.ResourceMetadata>>> Returns aListenableFutureto the snapshot of the subscribed resources as they are at the moment of the call.Map<String, XdsResourceType<?>> voidhandleResourceResponse(XdsResourceType<?> xdsResourceType, Bootstrapper.ServerInfo serverInfo, String versionInfo, List<com.google.protobuf.Any> resources, String nonce, io.grpc.xds.client.XdsClient.ProcessingTracker processingTracker) voidhandleStreamClosed(io.grpc.Status error) voidhandleStreamRestarted(Bootstrapper.ServerInfo serverInfo) booleanReturnstrueifXdsClient.shutdown()has been called.voidshutdown()Shutdown thisXdsClientand release resources.protected voidstartSubscriberTimersIfNeeded(Bootstrapper.ServerInfo serverInfo) For all subscriber's for the specified server, if the resource hasn't yet been resolved then start a timer for it.toString()<T extends XdsClient.ResourceUpdate>
voidwatchXdsResource(XdsResourceType<T> type, String resourceName, XdsClient.ResourceWatcher<T> watcher, Executor watcherExecutor) Registers a data watcher for the given Xds resource.Methods inherited from class XdsClient
canonifyResourceName, isResourceNameValid, percentEncodePath, watchXdsResource
-
Field Details
-
INITIAL_RESOURCE_FETCH_TIMEOUT_SEC
public static final int INITIAL_RESOURCE_FETCH_TIMEOUT_SEC- See Also:
-
-
Constructor Details
-
XdsClientImpl
public XdsClientImpl(XdsTransportFactory xdsTransportFactory, Bootstrapper.BootstrapInfo bootstrapInfo, ScheduledExecutorService timeService, io.grpc.internal.BackoffPolicy.Provider backoffPolicyProvider, com.google.common.base.Supplier<com.google.common.base.Stopwatch> stopwatchSupplier, io.grpc.internal.TimeProvider timeProvider, MessagePrettyPrinter messagePrinter, Object securityConfig)
-
-
Method Details
-
handleResourceResponse
public void handleResourceResponse(XdsResourceType<?> xdsResourceType, Bootstrapper.ServerInfo serverInfo, String versionInfo, List<com.google.protobuf.Any> resources, String nonce, io.grpc.xds.client.XdsClient.ProcessingTracker processingTracker) -
handleStreamClosed
public void handleStreamClosed(io.grpc.Status error) -
handleStreamRestarted
-
shutdown
-
isShutDown
public boolean isShutDown()Description copied from class:XdsClientReturnstrueifXdsClient.shutdown()has been called.- Overrides:
isShutDownin classXdsClient
-
getSubscribedResourceTypesWithTypeUrl
- Specified by:
getSubscribedResourceTypesWithTypeUrlin interfaceXdsClient.ResourceStore
-
getSubscribedResources
@Nullable public Collection<String> getSubscribedResources(Bootstrapper.ServerInfo serverInfo, XdsResourceType<? extends XdsClient.ResourceUpdate> type) Description copied from interface:XdsClient.ResourceStoreReturns the collection of resources currently subscribing to ornullif not subscribing to any resources for the given type.Note an empty collection indicates subscribing to resources of the given type with wildcard mode.
- Specified by:
getSubscribedResourcesin interfaceXdsClient.ResourceStore
-
getSubscribedResourcesMetadataSnapshot
public com.google.common.util.concurrent.ListenableFuture<Map<XdsResourceType<?>, Map<String, XdsClient.ResourceMetadata>>> getSubscribedResourcesMetadataSnapshot()Description copied from class:XdsClientReturns aListenableFutureto the snapshot of the subscribed resources as they are at the moment of the call.The snapshot is a map from the "resource type" to a map ("resource name": "resource metadata").
- Overrides:
getSubscribedResourcesMetadataSnapshotin classXdsClient
-
getSecurityConfig
Description copied from class:XdsClientReturns the implementation specific security configuration used in this XdsClient.- Overrides:
getSecurityConfigin classXdsClient
-
watchXdsResource
public <T extends XdsClient.ResourceUpdate> void watchXdsResource(XdsResourceType<T> type, String resourceName, XdsClient.ResourceWatcher<T> watcher, Executor watcherExecutor) Description copied from class:XdsClientRegisters a data watcher for the given Xds resource.- Overrides:
watchXdsResourcein classXdsClient
-
cancelXdsResourceWatch
public <T extends XdsClient.ResourceUpdate> void cancelXdsResourceWatch(XdsResourceType<T> type, String resourceName, XdsClient.ResourceWatcher<T> watcher) Description copied from class:XdsClientUnregisters the given resource watcher.- Overrides:
cancelXdsResourceWatchin classXdsClient
-
addClusterDropStats
public LoadStatsManager2.ClusterDropStats addClusterDropStats(Bootstrapper.ServerInfo serverInfo, String clusterName, @Nullable String edsServiceName) Description copied from class:XdsClientAdds drop stats for the specified cluster with edsServiceName by using the returned object to record dropped requests. Drop stats recorded with the returned object will be reported to the load reporting server. The returned object is reference counted and the caller should useLoadStatsManager2.ClusterDropStats.release()to release its hard reference when it is safe to stop reporting dropped RPCs for the specified cluster in the future.- Overrides:
addClusterDropStatsin classXdsClient
-
addClusterLocalityStats
public LoadStatsManager2.ClusterLocalityStats addClusterLocalityStats(Bootstrapper.ServerInfo serverInfo, String clusterName, @Nullable String edsServiceName, Locality locality) Description copied from class:XdsClientAdds load stats for the specified locality (in the specified cluster with edsServiceName) by using the returned object to record RPCs. Load stats recorded with the returned object will be reported to the load reporting server. The returned object is reference counted and the caller should useLoadStatsManager2.ClusterLocalityStats.release()to release its hard reference when it is safe to stop reporting RPC loads for the specified locality in the future.- Overrides:
addClusterLocalityStatsin classXdsClient
-
getBootstrapInfo
Description copied from class:XdsClientReturns the config used to bootstrap this XdsClientBootstrapper.BootstrapInfo.- Overrides:
getBootstrapInfoin classXdsClient
-
toString
-
startSubscriberTimersIfNeeded
Description copied from class:XdsClientFor all subscriber's for the specified server, if the resource hasn't yet been resolved then start a timer for it.- Overrides:
startSubscriberTimersIfNeededin classXdsClient
-
getOrCreateControlPlaneClient
public io.grpc.xds.client.ControlPlaneClient getOrCreateControlPlaneClient(Bootstrapper.ServerInfo serverInfo) -
getServerLrsClientMap
Description copied from class:XdsClientReturns a map of control plane server info objects to the LoadReportClients that are responsible for sending load reports to the control plane servers.- Overrides:
getServerLrsClientMapin classXdsClient
-