Class XdsClient

  • Direct Known Subclasses:
    XdsClientImpl

    @ExperimentalApi("https://github.com/grpc/grpc-java/issues/10862")
    public abstract class XdsClient
    extends java.lang.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 Detail

      • XdsClient

        public XdsClient()
    • Method Detail

      • isResourceNameValid

        public static boolean isResourceNameValid​(java.lang.String resourceName,
                                                  java.lang.String typeUrl)
      • canonifyResourceName

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

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

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

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

        public java.lang.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<java.util.Map<XdsResourceType<?>,​java.util.Map<java.lang.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").

      • addClusterDropStats

        public LoadStatsManager2.ClusterDropStats addClusterDropStats​(Bootstrapper.ServerInfo serverInfo,
                                                                      java.lang.String clusterName,
                                                                      @Nullable
                                                                      java.lang.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,
                                                                              java.lang.String clusterName,
                                                                              @Nullable
                                                                              java.lang.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 java.util.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.