Package io.grpc.xds

Class XdsNameResolver

java.lang.Object
io.grpc.NameResolver
io.grpc.xds.XdsNameResolver

final class XdsNameResolver extends io.grpc.NameResolver
A NameResolver for resolving gRPC target names with "xds:" scheme.

Resolving a gRPC target involves contacting the control plane management server via xDS protocol to retrieve service information and produce a service config to the caller.

See Also:
  • Field Details

    • CLUSTER_SELECTION_KEY

      static final io.grpc.CallOptions.Key<String> CLUSTER_SELECTION_KEY
    • RPC_HASH_KEY

      static final io.grpc.CallOptions.Key<Long> RPC_HASH_KEY
    • enableTimeout

      static boolean enableTimeout
    • logId

      private final io.grpc.InternalLogId logId
    • logger

      private final XdsLogger logger
    • targetAuthority

      @Nullable private final String targetAuthority
    • target

      private final String target
    • serviceAuthority

      private final String serviceAuthority
    • encodedServiceAuthority

      private final String encodedServiceAuthority
    • overrideAuthority

      private final String overrideAuthority
    • serviceConfigParser

      private final io.grpc.NameResolver.ServiceConfigParser serviceConfigParser
    • syncContext

      private final io.grpc.SynchronizationContext syncContext
    • scheduler

      private final ScheduledExecutorService scheduler
    • xdsClientPoolFactory

      private final XdsClientPoolFactory xdsClientPoolFactory
    • random

      private final ThreadSafeRandom random
    • filterRegistry

      private final FilterRegistry filterRegistry
    • hashFunc

      private final XxHash64 hashFunc
    • clusterRefs

    • configSelector

      private final XdsNameResolver.ConfigSelector configSelector
    • randomChannelId

      private final long randomChannelId
    • routingConfig

      private volatile XdsNameResolver.RoutingConfig routingConfig
    • listener

      private io.grpc.NameResolver.Listener2 listener
    • xdsClientPool

      private io.grpc.internal.ObjectPool<XdsClient> xdsClientPool
    • xdsClient

      private XdsClient xdsClient
    • callCounterProvider

      private XdsNameResolverProvider.CallCounterProvider callCounterProvider
    • resolveState

      private XdsNameResolver.ResolveState resolveState
    • receivedConfig

      private boolean receivedConfig
  • Constructor Details

  • Method Details

    • getServiceAuthority

      public String getServiceAuthority()
      Specified by:
      getServiceAuthority in class io.grpc.NameResolver
    • start

      public void start(io.grpc.NameResolver.Listener2 listener)
      Overrides:
      start in class io.grpc.NameResolver
    • expandPercentS

      private static String expandPercentS(String template, String replacement)
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in class io.grpc.NameResolver
    • generateServiceConfigWithMethodConfig

      static Map<String,?> generateServiceConfigWithMethodConfig(@Nullable Long timeoutNano, @Nullable VirtualHost.Route.RouteAction.RetryPolicy retryPolicy)
    • getXdsClient

      XdsClient getXdsClient()
    • updateResolutionResult

      private void updateResolutionResult()
    • matchHostName

      static boolean matchHostName(String hostName, String pattern)
      Returns true iff hostName matches the domain name pattern with case-insensitive.

      Wildcard pattern rules:

      1. A single asterisk (*) matches any domain.
      2. Asterisk (*) is only permitted in the left-most or the right-most part of the pattern, but not both.
    • combineInterceptors

      private static io.grpc.ClientInterceptor combineInterceptors(List<io.grpc.ClientInterceptor> interceptors)
    • getHeaderValue

      @Nullable private static String getHeaderValue(io.grpc.Metadata headers, String headerName)
    • prefixedClusterName

      private static String prefixedClusterName(String name)
    • prefixedClusterSpecifierPluginName

      private static String prefixedClusterSpecifierPluginName(String pluginName)