Class XdsClient

java.lang.Object
io.grpc.xds.client.XdsClient
Direct Known Subclasses:
XdsClientImpl

@ExperimentalApi("https://github.com/grpc/grpc-java/issues/10862") public abstract class XdsClient extends Object
An XdsClient instance encapsulates all of the logic for communicating with the xDS server. It may create multiple RPC streams (or a single ADS stream) for a series of xDS protocols (e.g., LDS, RDS, VHDS, CDS and EDS) over a single channel. Watch-based interfaces are provided for each set of data needed by gRPC.
  • Constructor Details

    • XdsClient

      public XdsClient()
  • Method Details

    • isResourceNameValid

      public static boolean isResourceNameValid(String resourceName, String typeUrl)
    • canonifyResourceName

      @ExperimentalApi("https://github.com/grpc/grpc-java/issues/10862") public static String canonifyResourceName(String resourceName)
    • percentEncodePath

      @ExperimentalApi("https://github.com/grpc/grpc-java/issues/10862") public static String percentEncodePath(String input)
    • shutdown

      public void shutdown()
      Shutdown this XdsClient and release resources.
    • isShutDown

      public boolean isShutDown()
      Returns true if shutdown() has been called.
    • getBootstrapInfo

      public Bootstrapper.BootstrapInfo getBootstrapInfo()
      Returns the config used to bootstrap this XdsClient Bootstrapper.BootstrapInfo.
    • getSecurityConfig

      public Object getSecurityConfig()
      Returns the implementation specific security configuration used in this XdsClient.
    • startSubscriberTimersIfNeeded

      protected void startSubscriberTimersIfNeeded(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.
    • getSubscribedResourcesMetadataSnapshot

      public com.google.common.util.concurrent.ListenableFuture<Map<XdsResourceType<?>,Map<String,XdsClient.ResourceMetadata>>> getSubscribedResourcesMetadataSnapshot()
      Returns a ListenableFuture to 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").

    • watchXdsResource

      public <T extends XdsClient.ResourceUpdate> void watchXdsResource(XdsResourceType<T> type, String resourceName, XdsClient.ResourceWatcher<T> watcher, Executor executor)
      Registers a data watcher for the given Xds resource.
    • watchXdsResource

      public <T extends XdsClient.ResourceUpdate> void watchXdsResource(XdsResourceType<T> type, String resourceName, XdsClient.ResourceWatcher<T> watcher)
    • cancelXdsResourceWatch

      public <T extends XdsClient.ResourceUpdate> void cancelXdsResourceWatch(XdsResourceType<T> type, String resourceName, XdsClient.ResourceWatcher<T> watcher)
      Unregisters the given resource watcher.
    • addClusterDropStats

      public LoadStatsManager2.ClusterDropStats addClusterDropStats(Bootstrapper.ServerInfo serverInfo, String clusterName, @Nullable String edsServiceName)
      Adds 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 use LoadStatsManager2.ClusterDropStats.release() to release its hard reference when it is safe to stop reporting dropped RPCs for the specified cluster in the future.
    • addClusterLocalityStats

      public LoadStatsManager2.ClusterLocalityStats addClusterLocalityStats(Bootstrapper.ServerInfo serverInfo, String clusterName, @Nullable 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. 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 use LoadStatsManager2.ClusterLocalityStats.release() to release its hard reference when it is safe to stop reporting RPC loads for the specified locality in the future.
    • getServerLrsClientMap

      public Map<Bootstrapper.ServerInfo,LoadReportClient> getServerLrsClientMap()
      Returns a map of control plane server info objects to the LoadReportClients that are responsible for sending load reports to the control plane servers.