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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private final class
private static final class
private class
private static class
VirtualHost-level configuration for request routing.Nested classes/interfaces inherited from class io.grpc.NameResolver
io.grpc.NameResolver.Args, io.grpc.NameResolver.ConfigOrError, io.grpc.NameResolver.Factory, io.grpc.NameResolver.Listener, io.grpc.NameResolver.Listener2, io.grpc.NameResolver.ResolutionResult, io.grpc.NameResolver.ResolutionResultAttr, io.grpc.NameResolver.ServiceConfigParser
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final io.grpc.CallOptions.Key
<String> private final ConcurrentMap
<String, XdsNameResolver.ClusterRefState> private final XdsNameResolver.ConfigSelector
(package private) static boolean
private final String
private final FilterRegistry
private final XxHash64
private io.grpc.NameResolver.Listener2
private final XdsLogger
private final io.grpc.InternalLogId
private final String
private final ThreadSafeRandom
private final long
private boolean
private XdsNameResolver.ResolveState
private XdsNameResolver.RoutingConfig
(package private) static final io.grpc.CallOptions.Key
<Long> private final ScheduledExecutorService
private final String
private final io.grpc.NameResolver.ServiceConfigParser
private final io.grpc.SynchronizationContext
private final String
private final String
private XdsClient
private io.grpc.internal.ObjectPool
<XdsClient> private final XdsClientPoolFactory
-
Constructor Summary
ConstructorsConstructorDescriptionXdsNameResolver
(URI targetUri, String name, String overrideAuthority, io.grpc.NameResolver.ServiceConfigParser serviceConfigParser, io.grpc.SynchronizationContext syncContext, ScheduledExecutorService scheduler, Map<String, ?> bootstrapOverride) XdsNameResolver
(URI targetUri, String targetAuthority, String name, String overrideAuthority, io.grpc.NameResolver.ServiceConfigParser serviceConfigParser, io.grpc.SynchronizationContext syncContext, ScheduledExecutorService scheduler, XdsClientPoolFactory xdsClientPoolFactory, ThreadSafeRandom random, FilterRegistry filterRegistry, Map<String, ?> bootstrapOverride) -
Method Summary
Modifier and TypeMethodDescriptionprivate static io.grpc.ClientInterceptor
combineInterceptors
(List<io.grpc.ClientInterceptor> interceptors) private static String
expandPercentS
(String template, String replacement) generateServiceConfigWithMethodConfig
(Long timeoutNano, VirtualHost.Route.RouteAction.RetryPolicy retryPolicy) private static String
getHeaderValue
(io.grpc.Metadata headers, String headerName) (package private) XdsClient
(package private) static boolean
matchHostName
(String hostName, String pattern) Returnstrue
iffhostName
matches the domain namepattern
with case-insensitive.private static String
prefixedClusterName
(String name) private static String
prefixedClusterSpecifierPluginName
(String pluginName) void
shutdown()
void
start
(io.grpc.NameResolver.Listener2 listener) private void
Methods inherited from class io.grpc.NameResolver
refresh, start
-
Field Details
-
CLUSTER_SELECTION_KEY
-
RPC_HASH_KEY
-
enableTimeout
static boolean enableTimeout -
logId
private final io.grpc.InternalLogId logId -
logger
-
targetAuthority
-
target
-
serviceAuthority
-
encodedServiceAuthority
-
overrideAuthority
-
serviceConfigParser
private final io.grpc.NameResolver.ServiceConfigParser serviceConfigParser -
syncContext
private final io.grpc.SynchronizationContext syncContext -
scheduler
-
xdsClientPoolFactory
-
random
-
filterRegistry
-
hashFunc
-
clusterRefs
-
configSelector
-
randomChannelId
private final long randomChannelId -
routingConfig
-
listener
private io.grpc.NameResolver.Listener2 listener -
xdsClientPool
-
xdsClient
-
callCounterProvider
-
resolveState
-
receivedConfig
private boolean receivedConfig
-
-
Constructor Details
-
XdsNameResolver
-
XdsNameResolver
XdsNameResolver(URI targetUri, @Nullable String targetAuthority, String name, @Nullable String overrideAuthority, io.grpc.NameResolver.ServiceConfigParser serviceConfigParser, io.grpc.SynchronizationContext syncContext, ScheduledExecutorService scheduler, XdsClientPoolFactory xdsClientPoolFactory, ThreadSafeRandom random, FilterRegistry filterRegistry, @Nullable Map<String, ?> bootstrapOverride)
-
-
Method Details
-
getServiceAuthority
- Specified by:
getServiceAuthority
in classio.grpc.NameResolver
-
start
public void start(io.grpc.NameResolver.Listener2 listener) - Overrides:
start
in classio.grpc.NameResolver
-
expandPercentS
-
shutdown
public void shutdown()- Specified by:
shutdown
in classio.grpc.NameResolver
-
generateServiceConfigWithMethodConfig
-
getXdsClient
XdsClient getXdsClient() -
updateResolutionResult
private void updateResolutionResult() -
matchHostName
Returnstrue
iffhostName
matches the domain namepattern
with case-insensitive.Wildcard pattern rules:
- A single asterisk (*) matches any domain.
- 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
-
prefixedClusterName
-
prefixedClusterSpecifierPluginName
-